5

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 :)

Fionnuala
  • 88,508
  • 7
  • 103
  • 141
Marek Jedliński
  • 6,528
  • 9
  • 44
  • 55

3 Answers3

16

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.

Ricardo Acras
  • 34,766
  • 15
  • 66
  • 109
avar
  • 1,170
  • 2
  • 13
  • 28
5

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.

vrad
  • 826
  • 1
  • 6
  • 15
0

Have you considered just using ODBC to connect to it?

JohnFx
  • 33,720
  • 18
  • 99
  • 158