trapping errors in stored procedures (newbie)

trapping errors in stored procedures (newbie)

Post by john from hert » Thu, 30 May 2002 20:31:40



I have a stored procedure which I call from an ASP to insert records.


insert a duplicate key.

The transaction is rolled back, and in the ASP I get the return code I set
in the SP,  but the message
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'  with the
violation message still appears on the web page.

How do I trap the error and then the return code to follow my own processing
in the ASP ?

 
 
 

trapping errors in stored procedures (newbie)

Post by Mary Chipma » Thu, 30 May 2002 22:28:11


In your situation, the best course of action would be to test to see
if the inserted value would cause a duplicate *before* attempting the
insertion. You can then return the information in an output parameter
to the client application. This saves resources on the server. Here's
a sample of the logic you'd use:





    FROM Table1


    BEGIN

      RETURN
    END

 -- If you get here, do the insert

-- Mary
MCW Technologies
http://www.mcwtech.com

On Wed, 29 May 2002 12:31:40 +0100, "john from herts"


>I have a stored procedure which I call from an ASP to insert records.


>insert a duplicate key.

>The transaction is rolled back, and in the ASP I get the return code I set
>in the SP,  but the message
>Microsoft OLE DB Provider for ODBC Drivers error '80040e14'  with the
>violation message still appears on the web page.

>How do I trap the error and then the return code to follow my own processing
>in the ASP ?


 
 
 

1. Trap Entended stored procedure errors in DBLIB

Hi,
        I am trying to TRAP errors from a stored procedure in DBLib.  The program
catches errors from DBLib, but when it comes to extended procedure the
DBLib Error handler or message handler are not able to catch them. I can
see  these errors when I run the procedure interactively. Does anyone have
any idea how to trap these errors.

thanks in advance,

Srikanth.

2. Analyzing Server Log Files: Is MS Olap Services practical ?

3. DTS with stored procedures / error trapping

4. restore issues

5. Trapping Errors Raised Within Stored Procedures

6. pgsql-server/src/backend/libpq be-secure.c

7. Trapping errors from stored procedure calls

8. SQL help!!!!!!!!!!!

9. Trapping error handles in extended stored procedures

10. Error trapping in stored procedure

11. Trapping and processing errors within stored procedures (SQL 7.0)

12. Stored Procedure error trap

13. Stored procedure error trapping from ASP