Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Try/Catch Routine Not Working
Message
De
09/02/2005 13:23:47
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00985235
Message ID:
00985268
Vues:
37
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
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform