Browse Source

2008-06-12 Marek Habersack <[email protected]>

	* SqlParameterCollection.cs: this [int] must check the range and
	throw an exception if necessary.
	
	* SqlCommand.cs: throw IOEX when stored procedure is not found in
	DeriveParameters. All procedures in MS SQL will report at least
	one parameter - the return value.

svn path=/trunk/mcs/; revision=105657
Marek Habersack 17 years ago
parent
commit
5d0f03654d

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

@@ -1,3 +1,12 @@
+2008-06-12  Marek Habersack  <[email protected]>
+
+	* SqlParameterCollection.cs: this [int] must check the range and
+	throw an exception if necessary.
+	
+	* SqlCommand.cs: throw IOEX when stored procedure is not found in
+	DeriveParameters. All procedures in MS SQL will report at least
+	one parameter - the return value.
+
 2008-06-10  Veerapuram Varadhan  <[email protected]>
 	
 	* SqlConnection.cs: TdsConnectionPool.GetConnectionPool() now returns 

+ 2 - 0
mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs

@@ -397,6 +397,8 @@ namespace System.Data.SqlClient {
 			}
 			reader.Close ();
 
+			if (parameters.Count == 0)
+				throw new InvalidOperationException ("Stored procedure '" + procName + "' does not exist.");
 		}
 
 		private void Execute (CommandBehavior behavior, bool wantResults)

+ 10 - 2
mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.cs

@@ -148,8 +148,16 @@ namespace System.Data.SqlClient
 		new
 #endif // NET_2_0
 		SqlParameter this [int index] {
-			get { return (SqlParameter) list [index]; }
-			set { list [index] = (SqlParameter) value; }
+			get {
+				if (index < 0 || index >= list.Count)
+					throw new IndexOutOfRangeException ("The specified index is out of range.");
+				return (SqlParameter) list [index];
+			}
+			set {
+				if (index < 0 || index >= list.Count)
+					throw new IndexOutOfRangeException ("The specified index is out of range.");
+				list [index] = (SqlParameter) value;
+			}
 		}
 
 		[Browsable (false)]