Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if ExecSQL worked?

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
Is there a way to determine if the SQL statement executed? I have a process where:

1. Update a table.
2. Update a different table.
3. Record a log entry of who did what

I'm regularly finding that step 1 and 3 worked, but step 2 didn't complete!

So, is there a way to determine if the ExecSQL statement worked properly before continuing?

Thanks!
leslie
 
PS - I'm using TQuery for all the statements.
 
The RowsAffected property of TQuery probably gives you what you want.

The Delphi 7 Help says
Inspect RowsAffected to determine how many rows were updated or deleted by the last query operation. If no rows were updated or deleted, RowsAffected has a value of zero. RowsAffected will have a value of –1 if the execution of the SQL statement could not be executed due to an error condition. This latter situation would typically follow the raising of an exception.

Andrew
Hampshire, UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top