Error handling with stored procedures. 
Author Message
 Error handling with stored procedures.

Hallo,

Does anyone know how to handle errors with stored
procedures called from vb. For example


AS

GO

How can I trap the error that CC may not be Null or that
CC must be unique. Then pass this back to the vb:

Set objCmd = CreateObject("ADODB.Command")
    If OpenConnection(objCnn) Then
        With objCmd
         .CommandType = 4 '--adCmdStoredProc
         .CommandText = "spProdiscImport"
         .ActiveConnection = objCnn

          '-- Add parameter


        End With

   '-- Execute SQL Query
   On Error Resume Next
   objCmd.Execute

   InsertRecord = (Err.Number = 0)

Any ideas?

Nigel....



Sat, 21 May 2005 21:26:17 GMT  
 Error handling with stored procedures.
Nigel,

Check next KB. I think this is what you need

http://support.microsoft.com/default.aspx?scid=KB;en-us;q194792

--
Val Mazur
Microsoft MVP


Quote:
> Hallo,

> Does anyone know how to handle errors with stored
> procedures called from vb. For example

> CREATE PROCEDURE spProdiscImport

> AS

> GO

> How can I trap the error that CC may not be Null or that
> CC must be unique. Then pass this back to the vb:

> Set objCmd = CreateObject("ADODB.Command")
>     If OpenConnection(objCnn) Then
> With objCmd
>          .CommandType = 4 '--adCmdStoredProc
> .CommandText = "spProdiscImport"
> .ActiveConnection = objCnn

>   '-- Add parameter


> End With

>    '-- Execute SQL Query
>    On Error Resume Next
>    objCmd.Execute

>    InsertRecord = (Err.Number = 0)

> Any ideas?

> Nigel....



Sat, 21 May 2005 21:46:48 GMT  
 Error handling with stored procedures.
Thanks Val,

This article is good...

Nigel...

Quote:
>-----Original Message-----
>Nigel,

>Check next KB. I think this is what you need

>http://support.microsoft.com/default.aspx?scid=KB;en-
us;q194792

>--
>Val Mazur
>Microsoft MVP


message

>> Hallo,

>> Does anyone know how to handle errors with stored
>> procedures called from vb. For example

>> CREATE PROCEDURE spProdiscImport

>> AS

>> GO

>> How can I trap the error that CC may not be Null or that
>> CC must be unique. Then pass this back to the vb:

>> Set objCmd = CreateObject("ADODB.Command")
>>     If OpenConnection(objCnn) Then
>> With objCmd
>>          .CommandType = 4 '--adCmdStoredProc
>> .CommandText = "spProdiscImport"
>> .ActiveConnection = objCnn

>>   '-- Add parameter

255)

>> End With

>>    '-- Execute SQL Query
>>    On Error Resume Next
>>    objCmd.Execute

>>    InsertRecord = (Err.Number = 0)

>> Any ideas?

>> Nigel....

>.



Sun, 22 May 2005 14:24:29 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Seeking advice on VB6->ADO->SQL Stored Procedure Error Handling

2. Seeking advice on VB6->ADO->SQL Stored Procedure Error Handling

3. Handling Messages from Stored Procedure Using ADO Error Object

4. Handling Errors Within Stored Procedure

5. Handling errors with stored procedures

6. To Stored Procedure or not to stored procedure

7. To stored procedure or not to stored procedure

8. sub report changes its source stored procedure to main report's stored procedure

9. To stored procedure or not to stored procedure

10. ado recordsets from stored procedures, stored procedures have input parameters

11. Create class function to handle 1 to many parameters for stored procedure

12. Error Handling Ignored in Outlook Procedure

 

 
Powered by phpBB® Forum Software