Hey Todd,
I'd say it's a bug somewhere in the SqlConnection class. I have no problem getting my catch to catch the error if I have either an empty connection string, or just bad info in the connection string. But, if you have stuff other than the keywords in the connection string, it blows up and the catch isn't catching it. The keywords being things like server=, database=, etc.
Doesn't help much, though does it? =(
~~Bonnie
>Einar,
>
>Thanks for replying on this!
>
>>My guess is that the error is "handeled" in the Open() method, i.e. there is a try catch in the Open() method that displays an error dialog and does not rethrow the error back up the call stack
>
>That sounds logical although not sure what to do about it.
>
>
>>Could you please post the code used to declare and initialize the oSWLConn object?
>
>
>SqlConnection oSQLConn = new SqlConnection();
>public string OpenSqlConnection(string cConnectionString)
>{
>oSQLConn.ConnectionString = cConnectionString;
>try
>{
>oSQLConn.Open();
>return oSQLConn.State.ToString();
>}
>catch
>{
>return "Failed";
>}
>}
>
>
>Thanks, Todd