Hi every one,
can any one please tell me the sol?
i have one sp in sql server which is able to throw the exception when the exception is occure. now i want to catch that exception from c#.net code and i want to print that exception on the screen? how can we handle the sql server exceptions from c# code. plz give me the code with db.
Handling exceptions
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

kiran kumarRank #3,110 · 461 reputationPosted Feb 13, 2010, 11:24 PM EST
try
{
some staements may cause exception here
//open up your connection
//execute your stored procedure located in database
}
catch(System.Data.SqlClient.SqlException ex)
{
Console.WriteLine(ex.Tostring())
}
finally
{
//clean up resources
}
check my ans if it helped you
Sam HobbsRank #107 · 20.5K reputationPosted Feb 12, 2010, 7:25 AM EST
hemanth hemanth21 reputationPosted Feb 12, 2010, 8:24 AM EST