Parcourir la source

2008-12-20 Gonzalo Paniagua Javier <[email protected]>

	* SqlConnection.cs: close the connection on error.


svn path=/trunk/mcs/; revision=121920
Gonzalo Paniagua Javier il y a 17 ans
Parent
commit
1bced9acdb

+ 4 - 0
mcs/class/System.Data/System.Data.SqlClient/ChangeLog

@@ -1,4 +1,8 @@
 
+2008-12-20 Gonzalo Paniagua Javier <[email protected]>
+
+	* SqlConnection.cs: close the connection on error.
+
 2008-12-16 Gonzalo Paniagua Javier <[email protected]>
 
 	* SqlParameter.cs: don't allocate error strings until the error

+ 4 - 0
mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs

@@ -302,6 +302,10 @@ namespace System.Data.SqlClient
 
 		private void ErrorHandler (object sender, TdsInternalErrorMessageEventArgs e)
 		{
+			try {
+				Close ();
+			} catch {
+			}
 			throw new SqlException (e.Class, e.LineNumber, e.Message, e.Number, e.Procedure, e.Server, "Mono SqlClient Data Provider", e.State);
 		}