Requirement is:

try
{
\\SQL Query
}
catch(Exception i)
{
print a
}
catch(SQLQueryException e)
{
\\SQL Query
}


Qu)I Got Exception in "try" block. Which "catch" statement
(i.e. 1st catch or 2nd catch ) catches the exception and
Why???

Answer Posted / sathish

There will be compile time error, becuase
the "..........catch(Exception ex)..........." is generic
exception block, where all type of exceptions are caught,
so when "catch(Exception ex)" is placed in the beginning,
then the following compile time error is thrown.

"A previous catch clause already catches all exceptions of
this or of a super type ('System.Exception')"

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is route config?

743


What is ViewData and TempData in ASP.Net MVC?

789


what is entity graph in entity framework?

840


Is it possible to cancel filter execution?

754


What is entity framework in asp net?

755


In .net compact framework, can we free memory explicitly without waiting for garbage collector to free the memory?

827


How to answer for project questions..?

2440


Explain what platforms does the .net framework run on?

783


what is csdl?

796


Explain how you can implement Ajax in MVC?

740


How does servicing work for the .net framework 3.0?

703


What is the difference between adding routes, to a webforms application and to an mvc application?

758


Is dapper better than entity framework?

745


Can you use Razor code in Javascript in ASP.Net MVC?

891


what is minimum requirement for entity framework applications to run?

827