Board index » delphi » Key violations when migrating from ODBC to BDE

Key violations when migrating from ODBC to BDE

Hello everybody!

I have to modify an existing app which uses ODBC. Since BDE seems to be
*much*  quicker than ODBC and speed is an issue in my case, I tried to
create an alias under BDE with the same name as in ODBC, and pointing to the
same database. I assumed this should work fine...but it does NOT. I get "Key
violation" errors which did not occur under ODBC.

Using BDE 5.01, with BCB5, Win NT4.

Any hints?

TIA

Paolo

 

Re:Key violations when migrating from ODBC to BDE


What database are you using? Did you delete the ODBC DSN?

--
Bill
(TeamB cannot answer questions received via email)

Re:Key violations when migrating from ODBC to BDE


Bill Todd (TeamB) a crit dans le message <3c347987$1_2@dnews>...

Quote
>What database are you using? Did you delete the ODBC DSN?

I'm using Access97 files (just one, in fact), and I did not delete anything
from the ODBC. I just renamed the existing alias to avoid conflicts (and to
be able to get back to a working state).

But as I performed further tests with the original ODBC alias, I had similar
problems. I wonder if I miss something or if something is corrupt somewhere
im my configuration.

Basically I have 2 linked tables M1 and S1. S1 has several records linked to
M1 via M1's primary key (autonumbered). I have to create a new record in M2,
copy some data from the current record of M1, and then create a set of
records in S2 from the records I find in S1 (some data comes from S1, and
additional fields are left empty until later).

I have trouble in repeating the problem for it does not occur in a
previsible fashion. Sometimes I get errors when inserting a record in M2,
sometimes when inserting it in S2, sometimes only when I post. The code is
fairly simple, and it used to work under BCB4 (written by somebody else
years ago). I'm now using BCB5 and have to improve the whole thing (quick of
course...).

Be assured I appreciate the time you spend to help (even though I try
several solutions to reproduce the problem consistently and thus may seem to
go random...which is partly true ;o)

Paolo

Re:Key violations when migrating from ODBC to BDE


1) Try using the Access repair option to repair your Access database and see
if that fixes the problem.

2) I strongly recommend that you do not use the BDE with an Access database.
Use the ADO data access components instead. Access 97 is the last version of
Access that the BDE Access driver supports because Microsoft changed to ADO
starting with Access 2000. Some day you will want to upgrade from Access 97
and you will have to convert to ADO at that point.

--
Bill
(TeamB cannot answer questions received via email)

Re:Key violations when migrating from ODBC to BDE


Bill Todd (TeamB) a crit dans le message <3c34d477_2@dnews>...

Quote
>1) Try using the Access repair option to repair your Access database and
see
>if that fixes the problem.

I already tried this (repair & compact)

Quote
>2) I strongly recommend that you do not use the BDE with an Access
database.
>Use the ADO data access components instead. Access 97 is the last version
of
>Access that the BDE Access driver supports because Microsoft changed to ADO
>starting with Access 2000. Some day you will want to upgrade from Access 97
>and you will have to convert to ADO at that point.

If I use ADO, I'll have to update from Access97 at once (I had problems in
another application). We'd prefer keeping on BDE if it can be done. But it's
an option we keep in mind.

Besides, I built a mini-app including only a few modules to test dthe
offending function standalone. It worked fine. This leads me to the
conclusion that a piece of code somewhere else is causing this mess.

One more question: I have several TTable objects which point to the same
table in the database file. Can this be an issue? There is only one which
writes data, but the others may read data on timer events.

Paolo

Re:Key violations when migrating from ODBC to BDE


Having multiple TTable components connected to the same database table
should not cause a problem.

--
Bill
(TeamB cannot answer questions received via email)

Other Threads