Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top