Accessing RETURN values from a Stored Procedure

  • Thread starter Thread starter peteZ
  • Start date Start date
P

peteZ

(meant to post this SQL ADO message here instead of the C# Group)

Using C#, I can access results returned from a stored procedure call OK, my
question
is how do you access the value from a RETURN statement in a stored procedure
?

eg. In the Example below - how can I check on the Value -1000 (Customer
not found) ?

@CID = customer id . . . .


-- Does Customer Exist ?
IF NOT EXISTS (SELECT 1 FROM Customers (NOLOCK) WHERE CID = @CID)
RETURN -1000

- Customer Exists, pass back values
SELECT FirstName, LastName FROM Customers WHERE CID = @CID

RETURN 0


thanks,

- peteZ
 
peteZ said:
(meant to post this SQL ADO message here instead of the C# Group)

Using C#, I can access results returned from a stored procedure call OK, my
question
is how do you access the value from a RETURN statement in a stored procedure
?

eg. In the Example below - how can I check on the Value -1000 (Customer
not found) ?

@CID = customer id . . . .


-- Does Customer Exist ?
IF NOT EXISTS (SELECT 1 FROM Customers (NOLOCK) WHERE CID = @CID)
RETURN -1000

- Customer Exists, pass back values
SELECT FirstName, LastName FROM Customers WHERE CID = @CID

RETURN 0


thanks,

- peteZ
 
Back
Top