Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading MS Access mdb files in Delphi (for free)? [closed]

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

like image 790
Marek Jedliński Avatar asked Apr 10 '09 00:04

Marek Jedliński


2 Answers

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.

like image 83
avar Avatar answered Oct 08 '22 07:10

avar


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.

like image 42
vrad Avatar answered Oct 08 '22 06:10

vrad