Handle SQL errors with severity 10
-
:confused:how to handle sql errors with severity less then 10 in C# .... From russia with love ....
-
-
frmRussia wrote: thanks my canadian bra, I'll assume that should be 'bro' and say 'Glad I could help'. :) Chris Meech I am Canadian. [heard in a local bar] Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden] Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
-
frmRussia wrote: thanks my canadian bra, I'll assume that should be 'bro' and say 'Glad I could help'. :) Chris Meech I am Canadian. [heard in a local bar] Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden] Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
ok bro. my sql server knowledge is like c# knowdlege --> like english , understand :laugh:. I wrote the link u advise me, but don't really know how to use it my app, if i write in the catch block: catch(System.Data.SqlClient.SqlError err) {....} i got compilation error, "The type caught or thrown must be derived from System.Exception" .... From russia with love ....
-
ok bro. my sql server knowledge is like c# knowdlege --> like english , understand :laugh:. I wrote the link u advise me, but don't really know how to use it my app, if i write in the catch block: catch(System.Data.SqlClient.SqlError err) {....} i got compilation error, "The type caught or thrown must be derived from System.Exception" .... From russia with love ....
I think that would be
catch(SqlException se)
{
}If there is only one error then the exception object will contain the details. If there is more than one error the exception object will contatin the details of only the first error. You then have to look in the errors collection for the other errors.
catch(SqlException se)
{
foreach(SqlError error in se.Errors)
{
// Do something with each error
}
}Does this help?
My: Blog | Photos WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
-
I think that would be
catch(SqlException se)
{
}If there is only one error then the exception object will contain the details. If there is more than one error the exception object will contatin the details of only the first error. You then have to look in the errors collection for the other errors.
catch(SqlException se)
{
foreach(SqlError error in se.Errors)
{
// Do something with each error
}
}Does this help?
My: Blog | Photos WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More