Ms Access

Could some one give an example App on how to connect to an Access database using DAO or OBDC?  I do not want to use the BDE.
caoidx1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chrbCommented:
Have you checked DSP or Torry's Delphi page? I have found some examples there. If you want I can find them for you.

Chr
0
BoRiSCommented:
I used this once can't remember were I got it though

to create a link to the ODBC driver

1. First start the BDE Administrator from the Windows Start Menu
(it will be in the Delphi 3.0 folder.)

2. Now select Object|ODBC administrator from the main menu.
(this will bring up a list of currently installed drivers.)

3. Choose Add and then select the ODBC driver you would like to create
a data source for, then click on OK.

4. Next fill in the appropriate information for your driver.
(A minimal configuration will require the  Data Source Name field.
You will also need to fill in at least one other field that is a
location specifier for the data. This could be a path in the case of
Paradox or dBase tables or the Server field in the case of configuring
an Interbase ODBC driver.  Some non-exhaustive examples include; if

you are using Interbase you would select a path to a .GDB file, if
using Paradox or dBASE files you would specify the data directory
containing your tables or if you were using Oracle you would specify
the entry as it appears in your TNSNAMES.ORA file.  Once this is done
you have created a virtual driver and will be able to access your
database files through the datasource your created.)

Hope this helps if not just reject it

Later
BoRiS
0
caoidx1Author Commented:
What is the proposed answer?
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

ssiteCommented:
I have a real answer for you. reject the current one.
0
GreedyCommented:
Do you still want to know how to do this...I'll put up how to do it with native drivers now if you want to know how to use ODBC I'll answer that later

1) open a new application...File | New Application
2) click on the Data Access Tab in your component pallet
3) select the Database component and drop it on your form
4) double click the Database component to reveal a dialog box
5) under Name put MyTestDB
6) under Alias name leave it blank
7) under Driver name put MSACCESS
8) click on the button Defaults
you will see

DATABASE NAME=DRIVE:/PATH/DATABASE.MDB
USER NAME=
OPEN MODE=READ/WRITE
LANGDRIVER=
SYSTEM DATABASE=
PASSWORD=

in the box to the left

after DATABASE NAME= put in the drive and path and name of your Access database

9) click OK
10) in the object inspector (that thing that has the properties and events tabs) go to the Connected property and set it to true.  This should pop up a login box, leave the fields blank and hit OK.  If you don't get an error you did it right.
There are a couple reason that you have failed.  If you get an error like MSACCESS -102764 error Please look at this web page

http://support.microsoft.com/support/kb/articles/Q141/2/94.asp

it will tell you how to reregister the dll...this happens after installing 97 on a system that had 95 on it before.  Hop this helps ODBC it about the same in dificulty but you don't have as many "wacko" thinks that can happen...NOTE:these "things" only pertain to the initial set up Native drivers are about 20 times better than the ODBC. (this is my opinion...I only use Access for design and depoly using MSSQL)


0
ssiteCommented:
Hey guys, the man said he does not want to use the BDE.

caoidx1 :

You have two possibilities :
Use the access objects via ole (using the api createobject function). This is not recommended if you plan to write a real access app, because it will make your life very difficult as opposed to VB for example.

The real solution will cost you about 300 $. There's a swiss company called Opus, they wrote a DAO wrapper for delphi. It's excellent. No problems and I'm even using their first version.

goto www.opus.ch   

have fun.

P.S, not that it matters too much, but I would expect a little more than 50. :-)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.