Board index » delphi » TQuery - Update failed (Oracle)

TQuery - Update failed (Oracle)

Hi all.

I work with D5 & Oracle 8.
In my project I use "CahedUpdates" query
(CashedUpdates=True, RequestLive=False, UpdateObject=....: TUpdateSQL)

I have a problem when I delete a record in following way:

1) I add a new record (Insert...FindField(...):='...'...Post)
2)I call ApplyUpdates (no matter whether TQuery.ApplyUpdates or
TDataBase.ApplyUpdates)
3)I delete the record I'VE JUST ADDED
4)I call ApplyUpdates
      Here I get an exception EDataBaseError with message: "Update failed".

This exception DOESN'T occur if:
- I don't perform the step 2 (ApplyUpdates)
- I delete another record
- I close and open this TQuery before step 3 (deleting)

How can I solve this problem without closing and reopening ?

Thanks,
Granat Yevgeny

 

Re:TQuery - Update failed (Oracle)


Is the primary key server generated?
If yes, client has no way to delete the correct record, because it does not
know the primary key value, unless you reopen the query. If you don't apply
updates, BDE just deletes the cached record. And if you delete another
record, it has the primary key value.

--
Robert

Quote
Granat Yevgeny wrote in message <3b723ea8_2@dnews>...
>Hi all.

>I work with D5 & Oracle 8.
>In my project I use "CahedUpdates" query
>(CashedUpdates=True, RequestLive=False, UpdateObject=....: TUpdateSQL)

>I have a problem when I delete a record in following way:

>1) I add a new record (Insert...FindField(...):='...'...Post)
>2)I call ApplyUpdates (no matter whether TQuery.ApplyUpdates or
>TDataBase.ApplyUpdates)
>3)I delete the record I'VE JUST ADDED
>4)I call ApplyUpdates
>      Here I get an exception EDataBaseError with message: "Update failed".

>This exception DOESN'T occur if:
>- I don't perform the step 2 (ApplyUpdates)
>- I delete another record
>- I close and open this TQuery before step 3 (deleting)

>How can I solve this problem without closing and reopening ?

>Thanks,
>Granat Yevgeny

Other Threads