What would be the best way to get a response to report back if each update was successful or not
if the query has executed successfully and you haven't caught any exception then it means it is a success. otherwise it failed.
Pregunta
I'm writing a small app that will be used to deploy stored procedure updates/releases across a number of servers.
I need to report back that the update on each server was successful.
At present I'm simply doing the following:
int response = server.ConnectionContext.ExecuteNonQuery(sql);
This successfully updates the sp, but the response is always a random minus number (-3, -4 etc).
What would be the best way to get a response to report back if each update was successful or not?
Solución
What would be the best way to get a response to report back if each update was successful or not
if the query has executed successfully and you haven't caught any exception then it means it is a success. otherwise it failed.
Otros consejos
You can implement Transaction (if your sql command based on multiple table) along with Try-Catch in SQL by using RAISERROR. You get get the error as output variable.