So use the debugger, and step through the code.
Put a breakpoint on the line:
string cs = ConfigurationManager.ConnectionStrings["SSMS"].ConnectionString;
And step through teh code looking at exactly what is in each variable. If the execution jumps to the
catch
block, then it's something to do with the last line it tried to execute - so move your breakpoint and run it again. This time, look very closely at exactly what is in where. It should be fairly obvious what is causing the problem, and that should tell you where to start looking for why that is happening. Or at least have much better information to give us when you ask a question about it! :laugh:
We can't do any of that for you: we can't run your code, and don't have access to your data!