예제 #1
0
        internal void DeriveParameters()
        {
            if (commandType != CommandType.StoredProcedure)
            {
                throw new InvalidOperationException(String.Format("TdsCommand DeriveParameters only supports CommandType.StoredProcedure, not CommandType.{0}", commandType));
            }
            ValidateCommand("DeriveParameters");

            TdsParameterCollection localParameters = new TdsParameterCollection(this);

            localParameters.Add("@P1", TdsType.NVarChar, commandText.Length).Value = commandText;

            string sql = "sp_procedure_params_rowset";

            Connection.Tds.ExecProc(sql, localParameters.MetaParameters, 0, true);

            TdsDataReader reader = new TdsDataReader(this);

            parameters.Clear();
            object[] dbValues = new object[reader.FieldCount];

            while (reader.Read())
            {
                reader.GetValues(dbValues);
                parameters.Add(new TdsParameter(dbValues));
            }
            reader.Close();
        }
예제 #2
0
		internal void DeriveParameters ()
		{
			if (commandType != CommandType.StoredProcedure)
				throw new InvalidOperationException (String.Format ("TdsCommand DeriveParameters only supports CommandType.StoredProcedure, not CommandType.{0}", commandType));
			ValidateCommand ("DeriveParameters");

			TdsParameterCollection localParameters = new TdsParameterCollection (this);
			localParameters.Add ("@P1", TdsType.NVarChar, commandText.Length).Value = commandText;

			string sql = "sp_procedure_params_rowset";

			Connection.Tds.ExecProc (sql, localParameters.MetaParameters, 0, true);

			TdsDataReader reader = new TdsDataReader (this);
			parameters.Clear ();
			object[] dbValues = new object[reader.FieldCount];

			while (reader.Read ()) {
				reader.GetValues (dbValues);
				parameters.Add (new TdsParameter (dbValues));
			}
			reader.Close ();	
		}