I think you misunderstood me... I already am raising errors in the stored
proc's... I want to know how I can find out what the error was when I ran it
inside of ADO.NET so I can respond to the error in my program
I think you misunderstood me... I already am raising errors in the stored
proc's... I want to know how I can find out what the error was when I ran it
inside of ADO.NET so I can respond to the error in my program
RAISEERROR(N'This is a message %s %d', -- message text
16, --severity
1, --state
N'number', --first argument
5); --second argument
and in your code you can get this error message in the SqlException object
try
{
ExecuteSP();
}
catch(SqlException ex)
{
Console.WriteLine(ex); //ex.Message will have the message text you used in
raiseerror
}
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.