Wednesday, March 21, 2012

Question about Insert/Update/Delete to return fail/success

I want the stored procedure of insert/update/delete
can return fail/success to asp.net , how can i do thatJoe
CREATE PROCEDURE Proc1 AS
BEGIN TRANSACTION
--UPDATE Table1
--INSERT INTO Table1
--DELETE Table1
SET @.Err = @.@.ERROR
IF @.Err <> 0
BEGIN
ROLLBACK TRANSACTION
RETURN (@.Err)
END
COMMIT TRANSACTION
--usage
EXEC @.Ret = Proc1
SELECT @.Ret = coalesce(nullif(@.Ret, 0),@.@.error,1001)
IF @.Ret <> 0
BEGIN
blabalabalabala --RAISERROR ('An error occured ........,10,1)
END
"joe" <joe@.discussions.microsoft.com> wrote in message
news:522DBA35-DFFF-4505-AAB5-10290E059279@.microsoft.com...
>I want the stored procedure of insert/update/delete
> can return fail/success to asp.net , how can i do that

No comments:

Post a Comment