pass sql errors to vb 
Author Message
 pass sql errors to vb

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

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
     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!

Mon, 03 Jan 2005 22:57:42 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Passing errors from SQL Server stored procedures to VB

2. Error codes passed from SQL Server to VB

3. SQL statement won't consistently pass from VB to SQL

4. Error 20639: SQL Expression error - Error in creating SQL Expression COM Parser (cpeaut32)

5. Passing an SQL error to an Access .mdb (DAO)

6. SQL Error when passed through ADO Connection

7. Error 800A0BB9 when trying to pass the Sql statement from page to page

8. Passing the DSN to the subreports/SQL Server error 20527

9. Error 3061 sql parameter passing problem

10. VB and SQL - creating a Database - errors, always errors

11. Passing Variables from to SQL

12. passing parameters to a sql query from a vb form


Powered by phpBB® Forum Software