Example #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();
        }
Example #2
0
        public TdsCommand(string commandText, TdsConnection connection, TdsTransaction transaction)
        {
            this.commandText      = commandText;
            this.connection       = connection;
            this.transaction      = transaction;
            this.commandType      = CommandType.Text;
            this.updatedRowSource = UpdateRowSource.Both;

            this.designTimeVisible = false;
            this.commandTimeout    = 30;
            parameters             = new TdsParameterCollection(this);
        }
		public TdsCommand (string commandText, TdsConnection connection, TdsTransaction transaction) 
		{
			this.commandText = commandText;
			this.connection = connection;
			this.transaction = transaction;
			this.commandType = CommandType.Text;
			this.updatedRowSource = UpdateRowSource.Both;

			this.designTimeVisible = false;
			this.commandTimeout = 30;
			parameters = new TdsParameterCollection (this);
		}
		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 ();	
		}