So, I am getting an exception in Stored Procedure whose error code is 547. I have created a data diagram in sql server, where I have defined the relationships.when I run the any delete SP I get an error saying FK conflict, which is right. My problem is how do I get the number(i.e 547) in my C# code.
catch (Exception ex)
{
lblMessage.Text = ex.Message;
}
I sthere any way where I can get this 547 code in my C# code.? Like
ex.somethin (which gives me the error message's code).