Question

I'm looking for a Delphi component / library to open and read from an mdb (MS Access) database. I will not be writing to the db or displaying the data; just need to read the db using whatever sql Access supports.

This is for a personal side-project (programming is not my paying job), so I need a free or a very inexpensive solution that works with any of Delphi 6, Delphi 2007 or Delphi 2009 (Professional editions all). Performance doesn't matter, simplicity does :)

Was it helpful?

Solution

http://www.teachitza.com/delphi/databasehowto.htm it is realy simple and easy task with 5-10 line of code. that was very usefull for me when i needed to just read some data from ms access files.

for starting u can use simple connection string like this

    DataSource := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + Filename +
    ';Persist Security Info=False';

  ADOConnection1.ConnectionString := DataSource;
  ADOConnection1.LoginPrompt := False;
  ADOConnection1.Connected := true;

  // ADOConnection1.GetTableNames(listbox1.items);

  AdoTable1.Connection := ADOConnection1;
  AdoTable1.ReadOnly := false; //if u want to make changes
  ADOTable1.active := false;
  ADOTable1.TableName := 'B2777'; //table name
  ADOTable1.active := true;

filnename is ur mdb file path+name. that is what i use for very simple tasks.

OTHER TIPS

I use ADO components included with Delphi for this ("Microsoft Jet 4.0 OLE Provider"). It requires MDAC installed on client, which is already included in XP and newer systems.

Have you considered just using ODBC to connect to it?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top