Parcourir la source

2005-01-27 Sureshkumar T <[email protected]>

	* SqlCommand.cs (DeriveParameters): Change parameter name to
	"procedure_name".
	* SqlParameter.cs (SqlParameter (object [])) : call default
	constructor to create Tds.Metaparameter.

	fixes bug #63122.


svn path=/trunk/mcs/; revision=39636
Sureshkumar T il y a 21 ans
Parent
commit
0c88f4428c

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

@@ -1,3 +1,12 @@
+2005-01-27  Sureshkumar T  <[email protected]>
+
+	* SqlCommand.cs (DeriveParameters): Change parameter name to
+	"procedure_name".
+	* SqlParameter.cs (SqlParameter (object [])) : call default
+	constructor to create Tds.Metaparameter.
+
+	fixes bug #63122.
+
 2005-01-03  Sureshkumar T  <[email protected]>
 
 	* SqlCommand.cs: Fixed bug #68973. Reset Tds.RecordsAffected to 0

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

@@ -300,7 +300,7 @@ namespace System.Data.SqlClient {
 			ValidateCommand ("DeriveParameters");
 
 			SqlParameterCollection localParameters = new SqlParameterCollection (this);
-			localParameters.Add ("@P1", SqlDbType.NVarChar, commandText.Length).Value = commandText;
+			localParameters.Add ("@procedure_name", SqlDbType.NVarChar, commandText.Length).Value = commandText;
 
 			string sql = "sp_procedure_params_rowset";
 
@@ -315,6 +315,7 @@ namespace System.Data.SqlClient {
 				parameters.Add (new SqlParameter (dbValues));
 			}
 			reader.Close ();	
+
 		}
 
 		private void Execute (CommandBehavior behavior, bool wantResults)

+ 13 - 8
mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs

@@ -114,9 +114,10 @@ namespace System.Data.SqlClient {
 		// This constructor is used internally to construct a
 		// SqlParameter.  The value array comes from sp_procedure_params_rowset.
 		// This is in SqlCommand.DeriveParameters.
-		internal SqlParameter (object[] dbValues)
+		internal SqlParameter (object[] dbValues) 
+                        : this (dbValues [3].ToString (), String.Empty)
 		{
-			Precision = 0;
+                        Precision = 0;
 			Scale = 0;
 			Direction = ParameterDirection.Input;
 
@@ -135,16 +136,20 @@ namespace System.Data.SqlClient {
 			case 4:
 				Direction = ParameterDirection.ReturnValue;
 				break;
+                        default:
+                                Direction = ParameterDirection.Input;
+                                break;
 			}
+			IsNullable = (dbValues [8] != null && 
+                                      dbValues [8] != DBNull.Value) ? (bool) dbValues [8] : false;
 
-			IsNullable = (bool) dbValues[8];
+			if (dbValues [12] != null && dbValues [12] != DBNull.Value)
+				Precision = (byte) ((short) dbValues [12]);
 
-			if (dbValues[12] != null)
-				Precision = (byte) ((short) dbValues[12]);
-			if (dbValues[13] != null)
-				Scale = (byte) ((short) dbValues[13]);
+			if (dbValues [13] != null && dbValues [13] != DBNull.Value)
+				Scale = (byte) ( (short) dbValues [13]);
 
-			SetDbTypeName ((string) dbValues[16]);
+			SetDbTypeName ((string) dbValues [16]);
 		}
 
 		#endregion // Constructors