Page 1 of 1

Simple question (I hope)

Posted: Fri 22 Jul 2005 14:51
by brekhof
I've got a problem updating a new record:
(all SQL was generated using the SDAC component's 'Generate SQL' option)
1. Insert a record in a table (the table has an identity field for the primary key)
2. call qry.post
3. call qry.edit
4. change some fieldvalues
5. call qry.post

at step 5. I get an error indicating that the primary key value is not known, I left all options/properties at their default values. Stopping the program after step 2. and restarting it makes the problem go away (not really an option).

Using Delphi 7 Pro, SDAC 3.55.0.16. MSDE 2000 SP4, Windows XP

Am I doing something wrong or is there a problem in the SDAC components?

regards,
Martin

Posted: Mon 25 Jul 2005 09:51
by Ikar
Most likely the problem is in incorrect generated SQLInsert, SQLUpdate.
Try to clear these properties at all.

Posted: Mon 25 Jul 2005 19:12
by brekhof
Ikar wrote:Most likely the problem is in incorrect generated SQLInsert, SQLUpdate.
Try to clear these properties at all.
I solved it for now by adding:

2a. qry.close
2b. qry.open

this way the data is forced to the database.

The SQL was generated by the SDAC component if that is any clue.

regards,
Martin

Posted: Tue 26 Jul 2005 09:01
by Ikar
> 2a. qry.close
> 2b. qry.open

It is quite slow solution. Clearing without regeneration SQLInsert and SQLUpdate allows to speed up working greatly.