By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,419 Members | 1,648 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,419 IT Pros & Developers. It's quick & easy.

Can't trap sql errors using ADO (DTS ActiveX task)

P: n/a
Hi,

I have the following piece of code which iterates through the potential
errors:
i =0
For Each error_item in myConn.Errors
DTSPackageLog.WriteStringToLog myConn.Errors(i).Description
DTSPackageLog.WriteStringToLog myConn.Errors(i).NativeError
i =i +1
Next

When I execute the procedure using the SQL Query Analyzer, I obtain
several errors in the message window. However, when I execute the
procedure from the ActiveX, nothing is pushed to the log file. In fact
I have even used the following piece of code to count the number of
errors:
DTSPackageLog.WriteStringToLog "myConn.Errors.Count: " &
myConn.Errors.Count
Returns always ZERO.
My procedure are pretty simple, I have the following:
Main procedure:
---------------
while 1 = 1
begin
fetch my_cursor into @count

begin transaction
-- merge the parent issuer into the table issuer
exec @last_error = test_proc @count
if @last_error <> 0 goto handle_error

commit transaction

-- handle the next record
continue

handle_error:
-- error(s), rollback the entire transaction
rollback transaction
test_proc procedure:
--------------------
a simple insert statement, this procedure can generate errors.

Thanks.

Jul 23 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.