Exception handling
Answers were Sorted based on User's Feedback
Answer / alb.shah
"An exception handler is a piece of code which will be
called when an exception occurs."
.NET Framework provides several classes to work with
exceptions. The keywords try, catch are used to handle
exceptions in .NET. You have to put the code (that can
cause an exception) in a try block. If an exception occurs
at any line of code inside a try block, the control of
execution will be transfered to the code inside the catch
block.
If any statement within the try block raises an exception,
the control of execution will be transfered to the first
line within the catch block. You can write the error
handling code in the catch block, like recording the error
message into a log file, sending an email to the
administrator about the problem occurred, showing an
appropriate error message to the user etc.
You can optionally use a 'finally' block along with the try-
catch. The 'finally' block is guaranteed to be executed
even if there is an exception.
If an exception is not 'handled' in code, the application
will crash and user will see an ugly message. Instead, you
can catch the exception, log the errors and show a friendly
message to the user.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / pavan
Yes. Multiple catch blocks may be put in a try block. See
code example below, to see multiple catch blocks being used
in C#.
class ClassA
{
public static void Main()
{
int y = 0;
try
{
val = 100/y;
Console.WriteLine("Line not executed");
}
catch(DivideByZeroException ex)
{
Console.WriteLine("DivideByZeroException" );
}
catch(Exception ex)
{
Console.WritLine("Some Exception" );
}
finally
{
Console.WriteLine("This Finally Line gets executed always");
}
Console.WriteLine("Result is {0}",val);
}
}
Read more:
http://discuss.itacumens.com/index.php?topic=17579.0#ixzz12vqW9paZ
... · ADO works with connected data. This
means ...
... when you access data, such as viewing and updating
data, it is real-time, with a ...
... being used all the time.
ADO.NET supports disconnected architecture. ...
... you access data, ADO.NET makes a copy of the data using
XML. ...
... make any requested updates. This makes ADO.NET
efficient to use for Web ...
... .
· ADO has one main object that is used to ...
... to create a new set of records. With ADO.NET, you have
various objects that ...
... relational model of your database.
· ADO allows you to create client-side ...
... only, whereas ADO.NET gives you the choice of using ...
... -side or server-side cursors. Whereas ADO allows you to
persist records in XML ...
... , ADO.NET allows you to manipulate data using. ...
Read more:
http://discuss.itacumens.com/index.php?action=search2#ixzz12w06GrN6
The DataAdapter object
plays the middleman between DataSet and database.
The DataSet represents a rich subset of the entire database,
cached on your machine without a continuous connection to
the database. The DataSet is comrised of DataTable objects
as well as Datarelation objects.
| Is This Answer Correct ? | 0 Yes | 0 No |
One of the properties of the Web Part has an incorrect format. Windows SharePoint Services cannot deserialize the Web Part. Check the format of the properties and try again. - this error is occured in Sharepoint 2007 while deploy the web part
What is the difference between response.redirect and server.transfer?
extensibility in asp.net2.0
Is redux flux?
Can I recieve both html markup for page and code in the asp.net web page's source code portion in the web browser?
If we remove web.config or machine.config from the application then, is this application will works?
What is ViewState? How is it encoded? Is it encrypted? Who uses ViewState ?
what is the advantage of data reader?
How many types of session in ASP.NET
what is the exact purpose of http handlers and interfaces?
Can a user browsing my Web site read my Web.config or Global.asax files ?
What is redirecting behavior?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)