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

What are server controls?

1 Answers   Avanade, Wipro,


why .net does not support multiple inheritance?

2 Answers   Microsoft,


How will you load an assembly which is not referenced by current assembly?

0 Answers  


What is .net3.0 and .net3.5?

0 Answers  


Why SOAP is required?

0 Answers   Alcatel-Lucent,






what is the default security setting in .net?

0 Answers  


What is namespaces in .net?

0 Answers  


What is Global Assembly Cache (GAC) and what is the Purpose of it?

1 Answers  


Differentiate between 'DataSet' and 'SQLDataReader' in ADO.NET?

0 Answers   QuestPond,


What is value type and refernce type in .net?

0 Answers  


Explain how to stop a thread?

0 Answers  


Is .net front end or backend?

0 Answers  


Categories