Board index » delphi » deleting records and updating

deleting records and updating


2003-10-16 07:21:50 PM
delphi98
I've got one question. I have a table with a record, and I delete it with a
sql query, but If I try to delete again without closing the app, it delete
again (but it doesn't exist). I think the table doesn't update after
deleting query.
I could solve the problem exiting the app, so: When I execute again the app
and try to delete the record it told me that the record doesn't exist. Must
I to close the table, and reopen again the table, before deleting query?
Thank you.
 
 

Re:deleting records and updating

"Jordi Maycas" <XXXX@XXXXX.COM>writes
Quote
>Must I to close the table, and reopen again the table, before deleting
query?

Thank you.


Yes. If your using your own SQL methods to delete records, the underlying
dataset has no idea that just happened. Think of it like taking a picture
of an apple tree. You take a picture, pull some apples off, would you
expect the picture to show the missing apples? Of course not, you throw
the old picture away (close the dataset) and take another picture
(opening/refreshing the dataset)
Good luck,
krf
 

Re:deleting records and updating

Always entertaing as usual ... :-) :-) If that is not copyrighted, I'd
like to use it some time.
 

Re:deleting records and updating

You mean someting like Table7.Requery? Is requery a method of Ttable, or
TAdoTble?
Thanks.
"Brian Bushay TeamB" <XXXX@XXXXX.COM>escribi?en el mensaje
Quote

>I could solve the problem exiting the app, so: When I execute again the
app
>and try to delete the record it told me that the record doesn't exist.
Must
>I to close the table, and reopen again the table, before deleting query?

You can Requrey the table instead of Close/open. Requery is faster but do
it
after the delete query.


--
Brian Bushay (TeamB)
XXXX@XXXXX.COM