How can I access my Data.mdb database with Delphi?

Posted on 2006-04-06
Medium Priority
Last Modified: 2010-04-05
Hi, im a newbie in programming and I was wondering how can I use a dbgrid for a .mdb Microsoft Access database I created (called Data.mdb). I have no idea what components to use, so I would be greatfull if someone could help me out.
Question by:fb132

Accepted Solution

RickJ earned 150 total points
ID: 16397915
For Delphi 7, you could use ADO components.
Drop an ADOConnection onto the form.
Drop an ADOTable onto the form.

You need to set the ConnectionString property for the ADOConnection, click the ... button, then click build.. For provider you could select Microsoft Jet.
Then browse to select your mdb on the connection tab.
You could also look at the advanced for permissions etc.

You can now set the Connection property of the ADOTable to the ADOConnection.
Then if you click on the TableName property of the ADOTable you should see a listing of the available tables/querys in your mdb. Select the one needed.

To connect this to your DBGrid you need to drop a DataSource component onto the form. Then set its dataset property to your ADOTable.
To connect to the grid set its datasource property to your Datasource component.

Thats it. :)

Obviously in code you would need to Open/Connect the ADOConnection. i.e  ADOConnection1.Connected := True ;
Once connected you can then open your ADOTable.  ADOTable.Open ;

This should be enough to get you started.

Expert Comment

ID: 16399443
RickJ given a nice explanation above
Also have a look into this. This is a nice tutorial step by step


Author Comment

ID: 16399553
Unfortunately I have Delphi 6, so my question is how do I get this ADO thing?
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 16399773
What version of Delphi 6?
I was sure 6 Professional had an ADO tab on the component palette.

Author Comment

ID: 16399780
Standard, it has simply the regular components minus the ADO

Expert Comment

ID: 16399880
I think you have a couple of options.
I am sure that with earlier versions of delphi you could import a type library (An MS dll) that gave you base level ADO access.
Or you could use some 3rd party components. There are free ones.
I have to go now. (Very late here)
Give me till the morning to dig up some exact details for you...??
Or someone else may jump in and help.
LVL 11

Expert Comment

ID: 16400091
I'm afraid you cannot use ADO or any other Database components with the standard edition of Delphi... no matter what version you are using.
This is the whole point of Standard edition.... NO database access.
Most of the components I've used or seen require that you have at least the professional version installed


Expert Comment

ID: 16406337
Thanks calinutz.
I have never used anything less than professional version.
Do you know (and I am sure fb132 would like to know) are there any data components you can get for standard? I notice you said "most components" not all.
Or is it a matter of having to upgrade?
I had a quick search and found nothing for standard version.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question