Solved

Access DB Connection.

Posted on 2003-11-09
3
192 Views
Last Modified: 2010-04-05
Hi Guys.

I want to write an application that will connect to a DB. I want that DB to be access.

What are my best options? I'm using Delphi7, and I have both the "DataAccess" TAB and the ADO Tab. Which are better?

Will one of them allow me to create installations that will also include the database? and will not make me use ODBC manually or things like that? can I avoid using ODBC at all?

M.
0
Comment
Question by:mertero
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 125 total points
ID: 9712976
Hello

   The best way to use access with Delphi is using ADO, and you will find all what you need in the ADO tab
the "Data Access" tab is for using DataSource, it's just a component to connect the Data Controls to the ADo Table, so you will need to use both tabs for Database Application

here's a quick steps to connecto using ADO

1. From Ado tab, drop AdoConnection and AdoTable
2. Click on ConnetionString property of ADoConnection you will see the ConnectionString Dailog, press build, then choose Micorosoft Jet 4.0 OLEDB provider, press Next then choose your .Mdb file
3. in AdoTable set the Connection propery to use the AdoConnection, and choose the TableName property to choose your table, set the Active property to True
4. in the "DataAccess" tab add one datasource to the form, and set it's Dataset Property to AdoTable1
5. from "Data Controls" tab, drop DBNavigator and DBGrid components on the from, set there DataSource property to DataSource1
 Run your application, and that's be your DB App ;-)

you can replace step 4 and 5, but double click on the AdoTable, you will see the field editor, press right click and choose Add all fields, the select the fields and drag them to the form, you will see Delphi Add DBEdit components automatically and one DataSource to the form

Hope that make it clear to you

Regards,
Mohammed Nasman
0
 

Author Comment

by:mertero
ID: 9713056
Hello Mohammed.

Sounds good. I see I will not need ODBC or anything. Cool. I'll have to check that it works first...

M.
0
 

Author Comment

by:mertero
ID: 9764920
Hi again. This works great, but I have one last question. If I want to install the application in several computers, can I change this string (The Connection string) from outside the application? or do I have to put the MDB in the exact same place?

Thanks,

M.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 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