Trapping CommitTrans - returns success even when failed!

S

Scott Meloney

Using VB6, SQL Server 2k, ADO 2.8, I am trying to implement an error handler
for ADO CommitTrans. I pause in the middle of transaction, pull the network
wire, then write more records and call CommitTrans. It completes without
error even though the data was not written. I have checked the Err
collection both in the main line and using withevents. They always indicate
success.. Am I missing something?
TIA!
 
M

Michel Walsh

Hi,


Some SQL manipulations fail silently. As example, in Access, if you do
not use the optional flag dbFailOnError, a


CurrentDb.Execute "... "

and that is occurs the statement is in error, NO ERROR would occur. We have
to use


CurrentDb.Execute "...", dbFailOnError


As for your database itself, it does not receive the Commit, so the
transaction is still open and would probably fails, internally, after some
timeout, with a rollback ( I assume ).



Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top