use .mdb database lazarus / 63-Database ---------------------------------------------------------------------- EMN2404 · 2016-04-26 19:08 I converted my delphi software and got stuck with compiling. Some properties from Delphi are missing, like Connection, ComandText and Fields. dtsConsult.Connection := MainForm.ADOConnectionExtract; dtsConsult.CommandText := StrSQL;  Format('%9.4f', [DBGridConsult.Fields[DataCol].AsCurrency]) What am I supposed to use instead? ---------------------------------------------------------------------- wp · 2016-04-26 21:48 "ADOConnection"? Do you use Delphi's ADO components? They are not available in Lazarus. But you can use SQLDB for get access to the mdb database: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);begin  //connection  ODBCConnection1.Driver := 'Microsoft Access Driver (*.mdb, *.accdb)';  ODBCConnection1.Params.Add('DBQ=.\test.mdb');  ODBCConnection1.Params.Add('Locale Identifier=1031');  ODBCConnection1.Params.Add('ExtendedAnsiSQL=1');  ODBCConnection1.Params.Add('CHARSET=ansi');  ODBCConnection1.Connected := True;  ODBCConnection1.KeepConnection := True;   //transaction  SQLTransaction1.DataBase := ODBCConnection1;  SQLTransaction1.Action := caCommit;  SQLTransaction1.Active := True;    SQLQuery1.DataBase := ODBCConnection1;  SQLQuery1.UsePrimaryKeyAsKey := False;  SQLQuery1.SQL.Text := 'select * from Customers';  SQLQuery1.Open;end; ---------------------------------------------------------------------- EMN2404 · 2016-04-26 23:24 Thanks, was able to compile, but when I ran the exe, it told me that it could not connect. I am attaching the captured image. What went wrong? ---------------------------------------------------------------------- wp · 2016-04-27 05:00 Is the mdb file in the same folder as the exe file? ---------------------------------------------------------------------- jma_sp · 2016-04-27 14:07 Hello WP. Can you add ithis block of code in the wiki section about databases?. If it works might be useful for others. Thanks ---------------------------------------------------------------------- wp · 2016-04-27 15:29 I added it to http://wiki.freepascal.org/MS_Access ---------------------------------------------------------------------- jma_sp · 2016-04-27 16:21 Thanks ---------------------------------------------------------------------- EMN2404 · 2016-05-06 06:04 Thanks for all the reply. I made a small project only to open the mdb file, but it didn't work. My mdb file contains a few dbf files, so my old Delphi program started opening the mdb file and depending what option I opened, it opened one of the dbf chosen file. Maybe a driver is missing? Checked MS website, there I found a AccessDatabaseEngine, one for 64 bits and one for 32 bits. My Windows is 64 bits, was created with Access from Office 2000 (32 bits). I installed the 32 bits of this driver, but still not able to opens mdb file. ---------------------------------------------------------------------- EMN2404 · 2016-05-06 06:05 and yes, my mdb file is in the same folder I have my program. ---------------------------------------------------------------------- wp · 2016-05-06 08:38 Quote from: EMN2404 on May 06, 2016, 08:04:21 amMy mdb file contains a few dbf filesdbf inside an mdb, how can this be? Well, if you say that your old Delphi program using ADO handles this correctly, I believe you that this is possible. But with Lazarus you don't open the database with ADO, but with ODBC, and I doubt if this will work. (But this is just my gut-feeling, may be wrong...) ---------------------------------------------------------------------- EMN2404 · 2016-05-07 03:50 Made a printscreen of the mdb file with the dbf files. Tried to upload it, but receive the message "The upload folder is full. Please try a smaller file and/or contact an administrator." - my jpg file is only 91 kb... ---------------------------------------------------------------------- wp · 2016-05-07 09:03 With a few exceptions it is best to pack files into a zip for upload. ---------------------------------------------------------------------- Hansvb · 2016-05-07 09:51 Zeoslib has a ado connection. That works fine with Access ---------------------------------------------------------------------- sfeinst · 2016-05-07 14:43 There are two ways I'm aware of to have DBF files be part of Access.  One is to import - in which case then they are Access tables.  The other is to define an external link within Access.  If that is what you are doing, then the DBf files are not truly within Access, they are just links to the existing files.  How the links are defined will affect whether or not they can be found.  You need to check your links to see if they are relative or absolute file locations.  And then you need to make sure your DBF files are in that location. I'm pretty sure that ODBC should be able to use the linked files.  You just need to make sure the files are accessible in relation to the MDB file. ---------------------------------------------------------------------- EMN2404 · 2016-05-08 02:15 It's been too many years that I wrote this software. It was originally a Clipper program that I transformed to Delphi at a job that we worked with Delphi. I guess I imported the dbf files into Access 2000. When I open the mdb file in Access, it shows a list of the dbf files. I can double-click any of the dbf files and it opens, showing the header and the data included - does that help?  Unfortunately I cannot upload the jpg file (print screen) showing the dbf files.