[thelist] Calling a sproc from VB

Anthony Baratta anthony at baratta.com
Wed Feb 4 12:48:30 CST 2004

At 10:33 AM 2/4/2004, Tab Alleman wrote:

>How can I see what the error is inside the sproc when I am calling the
>sproc from the VB app?

Are you doing any error trapping in your SP? e.g.



CREATE PROCEDURE [dbo].[sp_AddCustomer]

@CustomerName as varchar(50),
@CustomerNumber as varchar(20),
@CustomerStatus as varchar(12),
@AdminUser as varchar(20)


INSERT INTO Customers (
         VALUES (
         , at CustomerName
         , at CustomerStatus
         , at AdminUser
         , at AdminUser

IF (@@ERROR <> 0)
         SELECT 0 AS CustomerID, @@ERROR AS SQLErrorLevel, 'Insert Failed' 
as ErrorMessage
         SELECT @@IDENTITY as CustomerID



This way you check the return value, and if it's Zero there has been a failure.

Anthony Baratta
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."

More information about the thelist mailing list