Solved

Access DB Connection.

Posted on 2003-11-09
3
189 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:
mnasman 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

14 Experts available now in Live!

Get 1:1 Help Now