Hi all,
Can we make a SQL connection within catch block of a c# code? If so what is the procedure to do it. Because when i tried i am getting error saying "The operation is not valid for the state of the transaction."
SQL connection within Catch block
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Vincent Maverick DuranoRank #238 · 10.3K reputationPosted May 6, 2015, 4:30 AM EDT
Nanhe SiddiqueRank #1,103 · 1.7K reputationPosted May 6, 2015, 1:52 AM EDT
When an exception is thrown, the common language runtime (CLR) looks for the catch statement that handles this exception. If the currently executing method does not contain such a catch block, the CLR looks at the method that called the current method, and so on up the call stack. If no catch block is found, then the CLR displays an unhandled exception message to the user and stops execution of the program.
so general structure of try catch block