Hi,
Requirement is:
try
{
\\SQL Query
}
catch(Exception i)
{
print a
}
catch(SQLQueryException e)
{
\\SQL Query
}
Got Exception in "try" block. Which "catch" throws
exception and Why???

Please provide the answer in detail..

Thanks for the help!!!

Answers were Sorted based on User's Feedback



Hi, Requirement is: try { \\SQL Query } catch(Exception i) { print a } catch(SQ..

Answer / djana

I tried I got the following ...

Error 1 A previous catch clause already catches all exceptions of this or of a super type ('System.Exception') E:\dotnet\ConsoleApplication1\ConsoleApplication1\Program.cs 58 20 ConsoleApplication1

Is This Answer Correct ?    4 Yes 1 No

Hi, Requirement is: try { \\SQL Query } catch(Exception i) { print a } catch(SQ..

Answer / syed

The generic exception (Catch(Exception e)) should be
written after all the specific exceptions are written.
if any specific exception is written after the general
exception that will be of no use, as for all the exceptions
that were encountered in the try block will be catched by
the generic exception.
hope u got it.

Is This Answer Correct ?    3 Yes 0 No

Hi, Requirement is: try { \\SQL Query } catch(Exception i) { print a } catch(SQ..

Answer / kaushik

catch(SQLQueryException e)
{
\\SQL Query
}
would throw exception as a try can have more than one catch
block that the related exception can be handled individually

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More Dot Net General Interview Questions

Explain what is immutability, what is it for and how is it codified?

0 Answers  


Define marshling?

0 Answers  


What are situations when you register .NET assembly in GAC ?

0 Answers   UGC Corporation,


What is Active Directory? What is the namespace used to access the Microsoft Active Directories?

3 Answers  


What are the important components of .net?

0 Answers  






What is different between Web User Control and Web Custom Control?

1 Answers  


What is file extension of Webservices in .Net?

0 Answers   Arigo Infotech,


Which file is taken by compiler when we have both file Application and Server Configuration file?

0 Answers  


If we write any code for DataGrid methods, what is the access specifier used for that methods in the code behind file and why?

0 Answers  


What is Ajax? How it is related to your project?

0 Answers   Wipro,


What is .net environment?

0 Answers  


Who is using .net core?

0 Answers  


Categories