Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am executing a stored procedure from VB.Net the SP looks something like this:

 

CREATE PROC Name

@MachineID char(10),

@DateCreated smalldatetime,

@CreatedBy Varchar(20)

 

AS

 

IF EXISTS(SELECT Machine_ID FROM Table WHERE Machine_ID=@MachineID)

 

BEGIN

RAISERROR(50007,10,1)

RETURN -2

END

 

INSERT dbo.Table

(Machine_ID, DateCreated, CreatedBy)

VALUES

(@MachineID, @DateCreated, @CreatedBy)

 

------

 

How would i go about getting the returned value of -2 in VB.

 

I can Insert no problem but if the MachineID already exists in the db it completes it as normal and i cannot show the user that the record already exists and that it did not complete they need to change the machineID before it will enter the data.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...