Page 1 of 1

Simple question re insert and update

Posted: Sat 19 Mar 2011 04:01
by KevinS
How can I find out immediately whether an INSERT or UPDATE operation has been successful, since they both return a Recordcount of 0.

For example,

sql := 'INSERT INTO table . . . '
execute;

Success := ??????


I guess I could trap the exception, but is there some other way?

Posted: Mon 21 Mar 2011 09:46
by AndreyZ
Hello,

Besides exceptions, you can use the RowsAffected property, which is used to indicate the number of rows which were inserted, updated, or deleted during the last query operation. For more information please read the MyDAC documentation.

Posted: Mon 21 Mar 2011 14:11
by KevinS
AndreyZ wrote:RowsAffected property.
Thanks, that's exactly what I wanted to know.

Posted: Mon 21 Mar 2011 14:19
by AndreyZ
It is good to see that this problem was solved. If any other questions come up, please contact us.