Delphi - ODBC - Access. 
Author Message
 Delphi - ODBC - Access.

I am using delphi through ODBC to read and write an Access database.

I am using TDBGrid to display the contents of a single table (this works)

I am using a TNavigate (?) component to control updating and the adding
of new records.

I am using I am using five text input boxes to get info from the user,
and also to display the info from the selected line of the grid ready
for editting.

I am using one TDatabase component, one TTable component, and one
TDataSource component to attach all of these to the correct place in
the database.

I have two problems

        1. Whenever I display this form, and whenever I run this prog
           I am given a file locator dialog box to pinpoint the database
           with. This isn't what I had intended. I wanted to use a .INI
           file for the purpose of locating the database.
I am using Delphi through ODBC to read and write an Access database.

I am running Windows 95. Delphi standard (sql) edition. And access 2.0.
the system ODBC reports that I am using ODBC Access 7.0 (32bit).

I am using TDBGrid to display the contents of a single table (this works)

I am using a TNavigate (?) component to control updating and the adding
of new records.

I am using I am using five text input boxes to get info from the user,
and also to display the info from the selected line of the grid ready
for editting.

I am using one TDatabase component, one TTable component, and one
TDataSource component to attach all of these to the correct place in
the database.

I have two problems

        1. Whenever I display this form, and whenever I run this prog
           I am given a file locator dialog box to pinpoint the database
           with. This isn't what I had intended. I wanted to use a .INI
           file for the purpose of locating the database.

        2. Reading is fine. When I attempt to write the data by pressing
           the tick button on the navigator (in edit or new mode) I get
           an error -3001 from the ODBC driver. This is unprofessional.

I believe that the second problem is the cause of the MS ODBC driver for
access. Can anybody enlighten me as to the fix.

The first problem is probably just ignorance of ODBC, however the Delphi
manuals run a little threadbare on this subject and I know of no other
references.

Its also possible that Win95 just doesn't work the way I assume it should.
(and therefore the way most people would assume).

I could do with a few pointers here if you please.

Thanking you in advance for the time you spend enlightening this unworthy.

Bryan Dollery.



Mon, 16 Mar 1998 03:00:00 GMT  
 Delphi - ODBC - Access.

Quote:

>I am using Delphi through ODBC to read and write an Access database.
>I am running Windows 95. Delphi standard (sql) edition. And access 2.0.
>the system ODBC reports that I am using ODBC Access 7.0 (32bit).
>I am using TDBGrid to display the contents of a single table (this works)
>I am using a TNavigate (?) component to control updating and the adding
>of new records.
>I am using I am using five text input boxes to get info from the user,
>and also to display the info from the selected line of the grid ready
>for editting.
>I am using one TDatabase component, one TTable component, and one
>TDataSource component to attach all of these to the correct place in
>the database.
>I have two problems
>        1. Whenever I display this form, and whenever I run this prog
>           I am given a file locator dialog box to pinpoint the database
>           with. This isn't what I had intended. I wanted to use a .INI
>           file for the purpose of locating the database.

I have not worked with 32-bit ODBC, but when making a database available to
the Borland Database Engine (BDE) under Windows 3.1, this occurs unless you
run the ODBC Manager in Control Panel to define a new Data Source Name
(DSN). The new DSN will point to a specific database file, thus no prompt
when you use the ODBC access from within Delphi. Of course, this requires a
DSN for each MS Access database.

In 32-bit ODBC and Windows 95, I am not sure where you need to do this.

[...]

**************************************************************************
Steve Koterski
Local InterBase Server Technical Support
Borland International, Inc.



Mon, 16 Mar 1998 03:00:00 GMT  
 Delphi - ODBC - Access.

Quote:

>I am using Delphi through ODBC to read and write an Access database.

>I am running Windows 95. Delphi standard (sql) edition. And access 2.0.
>the system ODBC reports that I am using ODBC Access 7.0 (32bit).

>I am using TDBGrid to display the contents of a single table (this works)

>I am using a TNavigate (?) component to control updating and the adding
>of new records.

>I am using I am using five text input boxes to get info from the user,
>and also to display the info from the selected line of the grid ready
>for editting.

>I am using one TDatabase component, one TTable component, and one
>TDataSource component to attach all of these to the correct place in
>the database.

>I have two problems

>        1. Whenever I display this form, and whenever I run this prog
>           I am given a file locator dialog box to pinpoint the database
>           with. This isn't what I had intended. I wanted to use a .INI
>           file for the purpose of locating the database.

Ensure that you have correctly and completely defined the ODBC data source
or DSN via the ODBC Admisistrator utility in the Settings - Control Panel. Then
ensure that you have defined both a correct version (2.0) ODBC_Access driver
and an Alias that points at the DSN using the BDE. Then point the TTable
component at the alias using the Object Inspector.

That being done you will likely be prompted only for a Access/ODBC login either
when you start your application (if you open the database at that time) or when
you set the TTable Active property to True (whenever.) You can defeat the login
prompt by using a TDatabase component (optionally, inserted between your BDE
Alias and the TTable.)

Quote:
>        2. Reading is fine. When I attempt to write the data by pressing
>           the tick button on the navigator (in edit or new mode) I get
>           an error -3001 from the ODBC driver. This is unprofessional.

On the surface of it I would say there is an incompatibility between Delphi and
ODBC. I think I saw in that you were using a 32bit ODBC component? Since you're
using Access 2.0, you should be using 16-bit ODBC drivers, either version 2.0
(or 2.1 from MS Dev. Network.) Ordered from MS for approx. $10(US). Or there
is, apparently, a book called "Inside ODBC" which contains a disk.
Quote:

>Its also possible that Win95 just doesn't work the way I assume it should.
>(and therefore the way most people would assume).

Seems OK to me...so far.

- Show quoted text -

Quote:

>I could do with a few pointers here if you please.

>Thanking you in advance for the time you spend enlightening this unworthy.

>Bryan Dollery.




Mon, 16 Mar 1998 03:00:00 GMT  
 Delphi - ODBC - Access.

Quote:


>>I am using Delphi through ODBC to read and write an Access database.
>I have not worked with 32-bit ODBC, but when making a database available to
>the Borland Database Engine (BDE) under Windows 3.1, this occurs unless you
>run the ODBC Manager in Control Panel to define a new Data Source Name
>(DSN). The new DSN will point to a specific database file, thus no prompt
>when you use the ODBC access from within Delphi. Of course, this requires a
>DSN for each MS Access database.

>In 32-bit ODBC and Windows 95, I am not sure where you need to do this.

In my experience, under Windows NT (not sure about Win95), I need to
create a 16-bit data source for my (Watcom) database (using the 16-bit
ODBC Administrator). The BDE Config program won't recognize any
32-bit data sources that I created (with the 32-bit ODBC Admin).

I assume that this will be solved when Delphi32 (with 32-bit BDE)
is released. (drool, slobber...)

--


+-----------------------------------------------------------
|    Delphi, recumbent bikes, poker, hockey, Newton, wine



Tue, 17 Mar 1998 03:00:00 GMT  
 Delphi - ODBC - Access.

Quote:

>        2. Reading is fine. When I attempt to write the data by pressing
>           the tick button on the navigator (in edit or new mode) I get
>           an error -3001 from the ODBC driver. This is unprofessional.
>I believe that the second problem is the cause of the MS ODBC driver for
>access. Can anybody enlighten me as to the fix.

Error -3001 ("invalid query attribute") is not common; but error -1003
("invalid API parameter") is fairly common.

The solution is to get the most recent ODBC driver for Access 2.0 which is
available at a nominal charge from Microsoft or in several unusual places --
like the CD-ROM at the back of the book "Inside ODBC" (Kyle Geiger, Microsoft
Press, ISBN 1-55615-815-7.)

I don't know if the latest inline release of BDE, available from Borland FTP
and purported to fix "problems accessing Access 2.0 tables," includes a fix to
this problem as well... but don't feel rained on.  Even Access 2.0 itself
threw a lot of "-1003" errors before its Service Disk became available.

The reserved-error codes are defined in KBHELP/ACCKB2.EXE at FTP.MICROSOFT.COM
which is a self-extracting archive of a Windows help file (Access 2.0
Knowledge Base).

/mr/



Tue, 17 Mar 1998 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. delphi odbc access

2. Delphi,ODBC,Access and Passwords

3. Delphi ODBC access to AS/400 database

4. Delphi - ODBC - Access

5. Access 2.0 ODBC drivers for Delphi 1.0

6. ODBC - Access 2/Delphi 1 FAQ Anywhere?

7. General SQL error - Delphi 2 ODBC to Access 7.0 mdb

8. Delphi and Access - Setting ODBC Drivers

9. ACCESS ODBC Drivers with Delphi 1.0

10. V.Basic x Access - Delphi x ODBC - Transactions

11. Performance delphi 4 & Access through ODBC

12. Help : ODBC - Delphi 1 -Access - Cannot edit record changed by another user-

 

 
Powered by phpBB® Forum Software