Hallo everyone,
I would like to find out in my VB-project if errors occurred in a
stored procedure (MS-SQL-Server) with many successive sql statements.
I execute the stored procedure in VB with the execute method of an
ADODB-command.
I can read the error-number and description in VB, when the first
statement in the stored procedure goes wrong and sql returns nothing
but an error. The problem is that when an error happens after some
successful statements, then the error is not passed to VB. The reason
seems to be that sql returns more than just an error. In MS-SQL
Query-Analyzer it looks like this:
(1 row(s) affected)
(1 row(s) affected)
(1 row(s) affected)
(1 row(s) affected)
Server: Msg 2601, Level 14, State 3, Procedure xxx, Line 228
Cannot insert duplicate key row in object 'xxx' with unique index
'yyy'.
The statement has been terminated.
When I execute the stored procedure in VB within an error-handling
block and read the err.number it is 0. So the error is obviously not
passed to VB.
Does anyone know of a way to get this error in VB?
Thank you very much for your help!
Markus