1

When using the ADODB.Connection.Execute command, if the query returns a recordset, the ADODB.Recordset object can be checked for validity to confirm if the query/command was executed successfully.

Example:

SELECT * FROM users

If a command that updates rows but does not return records is executed, the ADODB.Connection.Execute command writes to the optional RecordsAffected variable. Is a count of the records affected and can be used to confirm if the query/command was executed successfully.

Example:

UPDATE users SET active = '0' WHERE...

How would you confirm if the query/command was executed successfully in the following example, or any situation where you are issuing a command that doesn't return records and no records are being affected?

Example:

SAVEPOINT FIRST_SAVEPOINT

Note: I am using OraOLEDB as my provider for the connection string.

Dodzi Dzakuma
  • 1,406
  • 2
  • 21
  • 39
  • With SQL Server, you can return @@RowCount to return the number of rows affected by a query. Perhaps Oracle has something similar. – George Mastros Jan 12 '15 at 18:09
  • It's possible with Oracle too, but my question is related to commands that wouldn't update or return rows. – Dodzi Dzakuma Jan 12 '15 at 19:17
  • If an error occurs when that command is executed, it should bubble up to the calling code which should raise an error in the VB6 code. If there is no error and no rows affected, would it be safe to assume that it executed successfully? – jakdep Jan 13 '15 at 03:20
  • @jakdep I was hoping to evaluate the recordset in some shape or form to achieve this, but trapping the error this way seems the best way to go. – Dodzi Dzakuma Jan 13 '15 at 14:45

0 Answers0