I'm connecting to an MS Access database using ODBCConnection and using an SQLQuery component. Everything works, mostly. I cannot under any circumstances send Access a double quoted string:
Works like you would think. No method of double quoting has worked: AnsiQuotedStr, QuotedString, Chr(34), ect. Double quotes are needed in Access for the wildcard characters to work. Why? I don't know, but it does.
I have tested all of these queries in Access against the database itself. Entering these generated queries into Acccess via copy and paste works every time it should. Below is a hardcoded example that I've been experimenting with.
tmp := 'SELECT * FROM address WHERE( AddStr LIKE "*elm*");';
And here's what I'm using to connect DSN-less to the database.
ODBCConnection1.Driver := 'Microsoft Access Driver (*.mdb, *.accdb)';
ODBCConnection1.Params.Clear;
ODBCConnection1.Params.Add('DBQ=D:\mydatabase.mdb');
ODBCConnection1.Connected := true;
ODBCConnection1.KeepConnection := true;
SQLTransaction1.Database := ODBCConnection1;
SQLTransaction1.Action := caCommit;
SQLTransaction1.Active := True;
SQLQuery1.DataBase := ODBCConnection1;
SQLQuery1.UsePrimaryKeyAsKey := False;
SQLQuery1.ParseSQL := False;
Mostly when I use double quotes I get ODB driver errors with "Too few parameters." If I do not get the error it pulls nothing from the database.
I'm going to sleep, if anyone has any suggestions, please let me know, and thank you in advance! I'm guessing it's something silly that I'm missing. I've been beating my head against the wall for hours now.
P.S. I also get an "External Access Violation" whenever I close the program while debugging. Literally, a blank form application with a ODBCConnection component connecting to a database is enough to throw the violation every single time on exit. And it's always beyond the scope of the program. In my work environment I run Lazarus as admin and it goes away. At home it shows up every time. These errors NEVER show up in release; all connections to the database are closed successfully. So I don't know if any of that has anything to do with it or not.