Hello friends,
Here is the code I am using to connect to an MS Access (.mdb) database without DSN using ODBConn and the ODBC driver provided by MDB Tools:
procedure TForm1.Button1Click(Sender: TObject);
var
conn: TODBCConnection;
trans: TSQLTransaction;
query: TSQLQuery;
begin
conn := TODBCConnection.Create(nil);
trans := TSQLTransaction.Create(nil);
query := TSQLQuery.Create(nil);
// connection
conn.Driver := 'MDBTools';
conn.Params.Add('DBQ=/home/will/test_data/office1');
conn.Connected := True;
conn.KeepConnection := True;
// transaction
trans.DataBase := conn;
trans.Action := caCommit;
trans.Active := True;
// query
query.DataBase := conn;
query.UsePrimaryKeyAsKey := False;
query.SQL.Text := 'SELECT FirstName, LastName FROM Patients WHERE LastName = ''SMITH''';
query.Open;
ListBox1.Items.Add(query.FieldByName('LastName').Value + ', ' + query.FieldByName('FirstName').Value);
end;
When I run this code, I get the following error:
Could not get updatable attribute for column 1. ODBC error details: LastReturnCode: SQL_ERROR;.
Column 1 is an autoincrementing large integer, which is also the primary key.
I have read other posts on the forums, and people generally say "Use a *real* database" when Access is brought up. Well, the issue here is that I'm trying to write a converter from Access to Firebird or possibly MariaDB, so I initially need to successfully read Access databases.
Does anyone have guidance on this issue?
Thanks everyone!

- Debian Linux 10 - amd64
- Lazarus 2.0.4
- FPC 3.0.4