<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><br><br><div dir="ltr">Sent from my iPhone</div><div dir="ltr"><br>Begin forwarded message:<br><br></div><blockquote type="cite"><div dir="ltr"><b>From:</b> Larry Dalton <larrydalton71@gmail.com><br><b>Date:</b> February 6, 2023 at 08:27:23 EST<br><b>To:</b> Lazarus mailing list <lazarus@lists.lazarus-ide.org><br><b>Subject:</b> <b>odbc driver</b><br><br></div></blockquote><blockquote type="cite"><div dir="ltr"><div dir="ltr"><div>Using  lazrus 2.2 ORC1-fpc-3.2.2-win64</div>error message: Project MyAccessPractice raised exception class EODBCException with message<div>'Could not connect with connection string'DRIVER=[Microsoft Access Driver(*.mdb,*.accdb)];</div><div>DBQ=C:\Lazarus_MSAccess\MyAccess.accdb;' ODBC error details: LastReturnCode:SQL-ERROR;Record1:SqlState:IM4002;NativeError  0; Message:[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified;</div><div><br></div><div>Here is the code, copied from internet</div><div><br></div><div>unit AccessUnit;<br>{$mode objfpc}{$H+}<br>interface<br>uses<br>  Classes, SysUtils, odbcconn, SQLDB, DB, Forms, Controls, Graphics, Dialogs,<br>  DBGrids, StdCtrls;<br>type<br>  { TForm1 }<br>  TForm1 = class(TForm)<br>    Button1: TButton;<br>    DataSource1: TDataSource;<br>    DBGrid1: TDBGrid;<br>    Label1: TLabel;<br>    ODBCConnection1: TODBCConnection;<br>    SQLQuery1: TSQLQuery;<br>    SQLTransaction1: TSQLTransaction;<br>    procedure Button1Click(Sender: TObject);<br>  private<br>  public<br>  end;<br>var<br>  Form1: TForm1;<br><br>implementation<br><br>{$R *.lfm}<br><br>{ TForm1 }<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> ODBCConnection1.Driver:='Microsoft Access Driver (*.mdb,*.accdb)';<br> ODBCCOnnection1.params.add('DBQ='+ExtractFilePath(Application.ExeName)+'MyAccess.accdb');<br> ODBCConnection1.Connected:=TRUE;<br> ODBCConnection1.KeepConnection:=TRUE;<br><br> SqlTransaction1.DataBase:=OdbcConnection1;<br><br> SqlQuery1.DataBase:=ODBCConnection1;<br> SQLQuery1.UsePrimaryKeyAsKey:=False;<br> SqlQuery1.SQL.Text:='Select * FROM Student';<br><br> Datasource1.DataSet:=Sqlquery1;<br> DBGrid1.DataSource:=DataSource1;<br><br> If ODBCConnection1.Connected then<br> begin<br>   label1.Caption:='Connected';<br>   end;<br><br> SqlQuery1.Open;<br>end;<br>end.   </div><div><br></div><div>Current MS Access Driver </div><div>Microsoft Access Driver (*.mdb,*,accdb) Version 16:00 15928020006</div><div><br></div><div><br></div><div><br></div><div>  <br></div></div>
</div></blockquote></body></html>