Zquery (how to know the status after execsql) lazarus / 16-Databases ---------------------------------------------------------------------- vcorp · 2015-08-26 16:10 Hello i'm a delphi developer and i'm using your components on my RealRally manager project. I'm writing a recovery routine to execute the logged query into a file. What i don't understand is this thing: I first do an update before an insert to know the status of that operation Using sqlyog i see if an update return 0 (no rows updated) or 1 (one row updated). based on that result is really easy know if i need to skip the insert query. There is a way to know what appen after executing a query from tzquery? i will try to be more clear with this example: Code: [Select]ZQuery1.SQL.Clear; ZQuery1.SQL.Add(Encrypt(Data[y], '1'));   // the string can be something like: UPDATE startlist Set Damage = 1 WHERE IdPilota = "vcorp" AND IdRally = "00000000000446"; ZQuery1.ExecSQL; I need to know after ExecSQL what happened if there are some row updated or 0 row are updated. Thanks for your Help, the version is 7.2 ---------------------------------------------------------------------- ezlage · 2015-08-26 17:51 Did you try this way? Code: [Select]ZQuery1.RowsAffected ---------------------------------------------------------------------- vcorp · 2015-08-26 18:49 Oh looks what i'm looking for. Dunno why i have missed it before. Will try to finish the code and i let you know if can be good enougth. Really appreciate your help. ---------------------------------------------------------------------- vcorp · 2015-08-27 20:03 Yes with a little trick that value is what i'm looking for. Thank you very much. ---------------------------------------------------------------------- exdatis · 2015-08-28 06:23 http://wiki.freepascal.org/Databases#Dataset_State ---------------------------------------------------------------------- vcorp · 2015-08-28 07:28 My way is better just bcz in my update query i have NOW() element this can return a 1 if a record exists and get updated (then i don't need to make the next query (insert of that update) and return zero if no update is done (this is good bcz in this case i can do the INSERT query of that record). A player can do the recovery job of a rally from my manage rmore than one time. Then using RowsAffected i'm sure to not create duplicate record.