I am tring to run a sql script from my c# application
string sql = File.ReadAllText(sqlFile);
string[] QueryArray= sql.Split(new string[] { "GO" }, StringSplitOptions.RemoveEmptyEntries);
foreach (string query in QueryArray)
{
cmd = new SqlCommand(query, Connection);
cmd.ExecuteNonQuery();
}
Then my script contains raiserror statement
RAISERROR ('Cannot procees' , 20, 1) WITH LOG
When I try to access this error message form my C# application, that won't happen. The error message return to me is:
A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)
Where I have gone wrong. What Do I need to do to get the error returned by the raiserror