Solved

Delphi 1 and MS Access

Posted on 1997-09-25
2
174 Views
Last Modified: 2010-04-04
I need to be able to use an Access database through ODBC using Delphi 1 (16Bit).  We are using Icon Author which creates the data and an application written in Delphi 1 which monitors the data.

Can anyone tell me STEP BY STEP how to do this?  I have tried umpteen ways and am at the end of my teather.

I created a new driver in the ODBC Administrator then created an alias to that driver with the BDE.  However, when I link a table to the alias, it says the database is not valid.

Any help would be appreciated.
0
Comment
Question by:Stuart_Johnson
2 Comments
 
LVL 5

Accepted Solution

by:
ronit051397 earned 100 total points
ID: 1346310
This is from Lloyd's help file, maybe it will help:

Q: How do I connect to Access via ODBC?
A: Alright gang. Here is my most straight forward explanation of how to connect your Delphi application to an Access 2.0 database. With this method, I have connected to Access 2.0 databases, and been able to read and write records to my hearts content.
NOTE: You MUST have the proper ODBC drivers. If you don't, this will not work!
REQUIRED DRIVERS:
ODBCJT16.DLL dated 11/18/94 or later
ODBCINST.DLL dated 08/17/94 or later
ODBCCTL16.DLL dated 11/18/94 or later
MSAJT200.DLL dated 11/18/94 or later
MSJETERR.DLL dated 11/18/94 or later
MSJETINT.DLL dated 11/18/94 or later

To the best of my knowledge, these are all of the drivers that are above and beyond your base ODBC drivers. You should be able to obtain these from MS on their FTP/WWW site, however I do not know exact directories. My company is a MS Solutions Provider, and we obtained these drivers on one of the many CDs we received
from MS.

Now for the meat of this posting:

To access a database via ODBC, you must first create an ODBC connection to the database.
1) Open Control Panel, and then select ODBC.
2) When the Data Sources dialog appears, select Add.
3) If you have installed all of the drivers properly, you should    see the following Access drivers:
   Access Data (*.mdb)
   Access Files(*.mdb)
   Microsoft Access Driver (*.mdb)
4) The one you MUST choose is the third one, Microsoft Access      Driver. Choosing any of the others will not work.
5) You will then be presented with the ODBC Microsoft Access 2.0    Setup dialog. Fill this in with the information regarding the    database to which you wish to connect.
6) Save the settings and then exit all the way out of Control      Panel. After having made a proper connection to the database    with ODBC, the rest is quite simple.
7) Open BDE Config.
8) Choose New ODBC Driver.
9) Give your SQL link a name
10) From the Default ODBC Driver combo box, you must choose the     Microsoft Access Driver, just the same as you did in the        ODBC setup. Do not choose Access Data/Files drivers.
11) If everything is setup properly, the name of your database     should appear in the Default Data Source Name combo box.    Select it now.
12) Select OK, you will be back to the main dialog for BDE         Config. Select the aliases tab.
13) Create a new alias, using the SQL link that you just created     (it will start with ODBC_) as your Alias Type.
14) Now save and exit from BDE Config.

You should now be able to get to you Access 2.0 database with both read and write instructions.

And finally...
I must say that having got to Access, via ODBC, you will probably wish you hadn't. It is sssllllooowww. Anytime we start adding layers, it gets slower and slower. Normally, I would recommend staying away from VB like the plague (I'm an old C++ hacker of many years, and the term BASIC makes me shudder). However, at this point in time, the best way to use Access databases is through either Access or VB. Microsoft is very close-mouthed about the structure of Access databases, and there is no indication that they are planning to change ("You either use VB/Access or we'll make you pay through the ODBC monster!"). Sorry, I digress. My recommendation, if you absolutely MUST use Access, then use VB. Otherwise, migrate your database to a more open system (Paradox,dBase/FoxPro,anything you can get a native engine), and use Delphi.

Lance Leverich

{ This code came from Lloyd's help file! }
0
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 1346311
Thanks for that mate.  Unfortunately we do have to use Access databases (dBase didnt work as we wanted and Icon Author does not support Paradox properly).

We have upgraded the application to 32bit and I am using a product called Opus DirectAccess.  It is damn quick and seems to work well.  I still hate Access dbs though :)

Thanks again for you help.

Stuart.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
oracle global variables 4 68
delphi parse string to params 3 123
Delphi Yen format 3 35
Dynamically Created Query 3 55
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
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 …

778 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