Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How can I connect my Application to an Access 2000 Database Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
28-Jun-03
Category
ADO/OLE-DB
Language
Delphi 5.x
Views
216
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Arp Dev 

How can I connect my Application to an Access 2000 Database

Answer:

You have an access 2000 Database with a few table and are not very familiar with 
ADO. You want to, at least, connect you database to your application (For example 
one of your friend don't have an access viewer and you want him to be able to read 
you Tip and Trick DataBase). 

Here how it work. 

First put a TADOConnection Component on your form. Open the object inspector and 
search for the connection string property. Click the 3 dot icon (...). You should 
see a windows with the following title bar: 
Form1.ADOConnection1 Connection String 

As it's our first connection ever we gonna use a connection string as 
connection Source. Click the second radio button. Don't type anything in the 
textbox, just click the build button to automate the process. 

Another windows appear named Data Link Properties. There 4 sections called 
Provider, Connection, Advanced ans All. Go in provider. 
As I don't want to go in detail and let you make a quick connection I recommend you 
chose the latest Microsoft Jet OLE Provider. On my version it's 4.0, if you don't 
have updated yet your sustem it will be 3.51. Click Next. 

You are now in the connection section. Click the 3 dot (...) to access your 
database with the open dialog. Ok following you are not a DataBase expert and don't 
share it with other users you don't need any login name / password, so delete the 
Admin default username.   
We don't need to edit the Advanced and All section. Leaves that blank and click ok, 
click ok another time. 

Back to the form. 

Open the object inspector. First set the LoginPrompt to false. Got to the connected 
property, make it true. You are connected! 

Wanna be sure? Yes, all was done non visual. We will put some visual components on 
the form but first we need to complete the non visual part. 

Add a TADODataSet to the form. Go to the Connection propery, click down and choose 
ADOConnection1. In CommandType click cmdTableDirect, we don't need any fancy thing, 
let's get straight to the point. In the command text property click down and select 
the main table of you app (I assume for this article that you have only one table). 
In the active property click true. 

The rest go a lot like BDE application. Go to the DataAccess category and put a 
TDataSource component on the form. Put it's DataSet property to ADODataSet1. 

We're ready for a visual component. Now put a TDBGrid on the form. 
In the DataSource property choose DataSource1. 

That's it your connected!

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC