?
Solved

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

Posted on 2006-04-06
8
Medium Priority
?
236 Views
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.
0
Comment
Question by:fb132
8 Comments
 
LVL 8

Accepted Solution

by:
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.
0
 
LVL 9

Expert Comment

by:sun4sunday
ID: 16399443
RickJ given a nice explanation above
Also have a look into this. This is a nice tutorial step by step
http://delphi.about.com/od/database/

sun4sunday
0
 

Author Comment

by:fb132
ID: 16399553
Unfortunately I have Delphi 6, so my question is how do I get this ADO thing?
0
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!

 
LVL 8

Expert Comment

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

Author Comment

by:fb132
ID: 16399780
Standard, it has simply the regular components minus the ADO
0
 
LVL 8

Expert Comment

by:RickJ
ID: 16399880
OK.
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.
0
 
LVL 11

Expert Comment

by:calinutz
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

Regards
0
 
LVL 8

Expert Comment

by:RickJ
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.
0

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