• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 333
  • Last Modified:

Delphi & Access

Need to connect a delphi application (delphi 6) to an access (2000 version) database.

What are the steps that I need to take or any clues please?

Thank you
0
donly9
Asked:
donly9
1 Solution
 
intheCommented:
steps to connect to access via odbc:

Odbc:

1:   Open Control Panel, and then select ODBC DataSources (32bit) .
2:   When the Data Source Administrator appears, Click Add.
3:   find the one that says  Microsoft Access Driver (*.mdb)
     click it and click finish.
4:   A dialog will popup called ODBC Microsoft Access Setup
5:   in "data source name" edit box well call it "MyAccess"
6:   description well say is "tesing msaccess connection".
7:   click select and find your .mdb file click ok to select it.
8:   click "advanced" and make sure login name and password are blank.
9:   close advanced.
10:  close microsoft access setup dialog
11:  close the  Data Source Administrator.

delphi:

1:  start or restart delphi if its already running.
2:  start a new project
3:  drop a ttable,tdbgrid,tdatasource,tdatabase on form.

    in object inspector:

4:  datasource1 dataset : table1
5:  dbgrid datasource   : datasource1
6:  database1 aliasname : MyAccess  
7:  database1 databasename : MyAccessDB //type a name instead of selecting one
8:  database1 loginprompt : false
9:  table1 databasename : MyAccessDB  //the name you typed is now selectable
10: table1 tablename : select a table
11: database1 connected : true
12: table1 active : true

or connect via ADO (from another q):

- Drop ADOConnection from ADO page
- On ConnectionString property of the ADOConnection component, click (...) button and click Build.
- Select Microsoft Jet 4.0 OLE DB Provider
- Click on Connection tab and select your Access database file.
- Turn LoginPrompt to False if you write the login name and password in your connection
- Drop ADOTable or ADOQuery
- In ADOTable or ADOQuery Connection property select Connection1
- ADOTable and ADOQuery are datasets so that they can treated as any normal BDE TTable and TQuery. You
can drop a DataSource and any data controls to be linked with your Access table .
0
 
MBoCommented:
The simplest case example:

a) add adotable,datasource and dbgrid

b) build adotable connectionstring, for example
1)Microsoft Jet...
2)choose database (C:\Program Files\Borland Shared\Data\dbdemos.mdb)
and login if you need

c) choose adotable tablename (country)

d) datasource1.dataset - adotable1

e) dbgrid1.datasource -  datasource1

if you make adotable Active, data are visible in design-time

Of course, you may use other db-aware components and ado components as well.
This is just starting point

0
 
donly9Author Commented:
Thank you inthe
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
mikepjCommented:
www.opus.ch is what I use with Delphi 5 and Access 97.  Very fast...and free.
0
 
intheCommented:
hi,
can you please accept one of comments as answer ,this closes the question from the open question lists.
thanks
Regards Barry
0
 
pnh73Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept answer from inthe

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now