Link to home
Start Free TrialLog in
Avatar of whpgabesz
whpgabesz

asked on

Rows affected after update

I am using delphi adocommand to update a table.
For example :
adocommand.commandtext := 'Update table set something = 'green'';

How can I get back the affected rows?
I am using ms Sql 2005.
Please write an example.
Thanks
Avatar of Geert G
Geert G
Flag of Belgium image

use a TAdoQuery instead
it has a property RowsAffected for this
Avatar of whpgabesz
whpgabesz

ASKER

Can you write an example?
ASKER CERTIFIED SOLUTION
Avatar of Geert G
Geert G
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can do...


adocommand.commandtext := 'Update table set something = 'green'';
adocommand.ExecSQL;
YourRowsAffected := adocommand.RowsAffected;

or shorter

adocommand.commandtext := 'Update table set something = 'green'';
YourRowsAffected := adocommand.ExecSQL;

It was an excellent answer. Thanks