148 Views
If you have ever come across a c# application or any asp.net application for that matter that appears to work perfectly then without warning starts to fail with database timeout issues. There is one of two things normally wrong. Either it is a database problem. Or another rather common problem is actually in the code inside the application. This is when the developers and the database guys normally start screaming at each other. This normally happens because the developers cannot reproduce any problems in their enviroment and the dba's know that there database is in perfect working order and see little or no load on the sql server. This can happen if you have the following code
No code in your try block will run after the point at which the exception occurred, and putting cleanup code outside the try/catch will not work either as that code may not be reached if the exception handling throws the exception up the call stack. What needs to be used here is a finally statement, which will run whether an exception is thrown or not.
string Args = "Data Source=SQL;Initial Catalog=Mess;Integrated Security=True;Connect Timeout=10;Timeout=10;Max Pool Size=10;"