Solved

Access Database connection

Posted on 2001-07-05
11
214 Views
Last Modified: 2010-04-06
i want to connect an access database from my application, without using any aliases. could anyone help me?

regard, raph
0
Comment
Question by:ralph78
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 3

Accepted Solution

by:
karouri earned 50 total points
ID: 6254666
first thing i can think of is, if you are using Delphi 5+ then use the ADO components, then you can write the ConnectionString at run time. If you want to use the BDE (in any delphi), then you can use a TDAtabase at run time too. Beware of using the BDE driver for Access 95 to open an Access 97 database.
So, what Delphi are you using, what Access version, and do you want to use the BDE (I hope not)?
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 6254669
If you have the ADO components, drop a TADOConection on your form and double-click on it. Then click 'Build'. Select 'Microsoft Jet 4.0 OLE DB Provider', 'Next' and type/browser the .mdb file (path can be relative or absolute). Now 'Test Connection' to see if it works.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 6254677
After that you may want to set TADOConnection.LoginPrompt to false.
0
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!

 
LVL 3

Expert Comment

by:alzv
ID: 6254688
Well... Use ADOExpress components (ADO tab).

1. Place ADOConnection component onto your form
2. Doubleclick on it to open ConnectionString editor
3. Press Build button
4. Choose Microsoft Jet OLE DB Provider and press Next
5. Select Access database file
6. Specify Password if needed
7. Press Test Connection button and if connection succeed press OK
8. Place ADOTable component and set its Connection property to previously placed ADOConnection component
9. Specify TableName property
10. Place DataSource component from Data Access tab and set it DataSet property to previously added ADOTable component
11. Place DBGrid component and specify its DataSource property
12. Set Active property of ADOTable component to True.

Best regards,
Alexey Zverev.
0
 

Author Comment

by:ralph78
ID: 6254738
errr... sorry, but i don't use the ado components (only th bde ones!) with access 97.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 6254785
Then I don't know a solution...
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 6254791
...unless creating an alias at runtime is an option:

http://www.bhnet.com.br/~simonet/tipstricks/alias.htm
0
 
LVL 44

Expert Comment

by:CrazyOne
ID: 6255717
Yep as Epsylon has said if you don't use ADO then you will need to use alias's in one form or another.
0
 

Expert Comment

by:amp072397
ID: 6789580
ralph78:

Just a friendly reminder to return to your open questions.

thanks!
amp
community support moderator

2/7
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 8702025
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 karouri's comment as answer (TDatabase at runtime)

From Delphi Help:
-----------------
AliasName and DriverName are mutually exclusive BDE-specific properties. AliasName specifies the name of an existing BDE alias to use for the database component. The alias appears in subsequent drop-down lists for dataset components so that you can link them to a particular database component. If you specify AliasName for a database component, any value already assigned to DriverName is cleared because a driver name is always part of a BDE alias.

Note: An application can specify the DatabaseName, DriverName, and Params properties rather than setting AliasName if the desired BDE alias configuration does not already exist. An application can also provide an application-specific “alias” name by setting DatabaseName when AliasName is already set.
-----------------

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

740 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