Testing if my sql operation has worked

  • Thread starter Thread starter Andy Levy
  • Start date Start date
A

Andy Levy

Hi -

If i run an Insert or Update SQL statement in VB using adodb - is there
anyway to test if the transaction has operated successfully, or failed ?

Thanks

Andy
 
If you Execute your action query statement, you have several choices:

- examine the Database's RecordsAffected to see how many records were
updated;
- use the dbFailOnError switch to crash out if there is a problem;
- wrap the whole thing in a transaction for an all-or-nothing result.

Example:
Dim db As DAO.Database
db.Execute strSQL, dbFailOnError
MsgBox db.RecordsAffected " & " record(s) updated."

Transaction example:
http://allenbrowne.com/ser-37.html
 
Back
Top