In your stored procedure, check if the row was deleted, and use RAISEERROR
] with a Severity >= 11 to cause SQL to throw an SQLException back to your code.
You can check the number of deleted rows by examining the @@ROWCOUNT
] variable in your SP.
"The stored procedure would not execute when I tried to save it to my database. I assume I had a syntax problem, which is why I asked for an example of it."
You haven't quite got the idea of stored procedures, or SQL syntax really, have you? :laugh:
CREATE PROC [dbo].Sample
@Name varchar(100) OUTPUT
... (body of SP)
Is a skeleton SP. Note the BEGIN and END, one of which is missing from yours!
Then there is the IF:
Which again, if a bit different from yours! The BEGIN after the IF is to denote the code that is executed if the condition is true, not the whole of the IF statement, hence the END before the ELSE.