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.
Loading
kiran kumarPosted Feb 14, 2010, 4:24 AM
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
hemanth hemanthPosted Feb 12, 2010, 1:24 PM
Sam HobbsPosted Feb 12, 2010, 12:25 PM