MisbahArefin
Thu Mar 06 11:46:04 CST 2008
try this in your stored proc
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
}
--
Misbah Arefin
https://mcp.support.microsoft.com/profile/MISBAH.AREFIN
http://www.linkedin.com/in/misbaharefin
"Smokey Grindel" wrote:
> 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
>
> "Misbah Arefin" <MisbahArefin@discussions.microsoft.com> wrote in message
> news:CA400CCD-B402-4CEF-9391-0A82CF137DB6@microsoft.com...
> > try RAISEERROR
> >
http://msdn2.microsoft.com/en-us/library/ms177497.aspx
> >
> > --
> > Misbah Arefin
> > https://mcp.support.microsoft.com/profile/MISBAH.AREFIN
> >
http://www.linkedin.com/in/misbaharefin
> >
> >
> > "Smokey Grindel" wrote:
> >
> >> Is there a way to get an error that is raised from a sql server stored
> >> procedure when executed from a sqlcommand object? thanks!
> >>
> >>
> >>
>
>
>