Solved

Delphi & Access

Posted on 2002-04-26
6
324 Views
Last Modified: 2010-04-04
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
Comment
Question by:donly9
6 Comments
 
LVL 17

Expert Comment

by:inthe
ID: 6972723
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
 
LVL 1

Expert Comment

by:MBo
ID: 6972724
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
 

Author Comment

by:donly9
ID: 6972874
Thank you inthe
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 2

Expert Comment

by:mikepj
ID: 7002839
www.opus.ch is what I use with Delphi 5 and Access 97.  Very fast...and free.
0
 
LVL 17

Accepted Solution

by:
inthe earned 50 total points
ID: 7003336
hi,
can you please accept one of comments as answer ,this closes the question from the open question lists.
thanks
Regards Barry
0
 
LVL 1

Expert Comment

by:pnh73
ID: 9004173
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 run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now