Give coding for Exception Handling Techniques in ASP.NET?
Answer Posted / senthil kumar
The exception handling techniques very use full to display
the errors in meaningfull way.
The syntax of exception handling as follows.
try
{
}
catch(Exception )
{
}
catch(Exception )
{
}
finally
{
}
Here the set of codes executed if any error found in try
block the catch block will be executed.We may have any
number of exception in catch but it will only one executed
according to the type of error.But the finally block must
executed automatically whether error found or not.
try
{
SqlConnection con = new SqlConnection();
con.ConnectionString =" ----";
String sql;
sql = "---";
SqlCommand cmd = new SqlCommand(sql,con);
cmd.CommandType = CommandType.Text;
cmd.ExectuteNonQuery();
}
catch(FileNotFoundException e)
{
Console.WriteLine("Error:"+e.Message);
}
catch(SqlException ee)
{
Console.WriteLine("Error:"+ee.Message);
}
finally
{
Console.WriteLine("This program written by S.Senthil
umar");
}
if this is correct ok.otherwise correct me.
Is This Answer Correct ? | 12 Yes | 1 No |
Post New Answer View All Answers
Code for Creating a Form Using PlaceHolder Controls?
How to Bind Nested XML to a Repeater Control with Container.DataItem?
Code for Presenting Parent/Child Data in a Data Grid Row?
Code for Document Validation in XML.NET?
how to track links visited in google using iframes
Code for Communicating over Sockets?
Coding for Synchronizing Cache Access in ASP.NET?
Common UI for Multiple web applications. Suppose there are 35 websites using same third party controls.These 3rd party controls are made together that all 35 websites can use these controls.If we put all 3rd party controls and use its dll in 35 websites,only class files will be accessable. But I want to use CSS,images also in all 35 websites. how I can design the N-tier solution for this project.
Coding for .NET Delegates?
how to create a search bar which access data from various websites and retrieves the data
Code for Using Keyboard Events?
ArrayList declaration in .net
How we use ajax in asp.net through javaScript. Please givee me an example.
How to get Dynamically Linked Comboboxes Set?
i have a gird with columns all are coming from database,this will bind in item templete in gridview as textboxex.and i have button below named Update.i want to update all the records in the grid,but if user change the value of one textbox,what is the easy way 2 do this