internal void DeriveParameters () { if (commandType != CommandType.StoredProcedure) throw new InvalidOperationException (String.Format ("SybaseCommand DeriveParameters only supports CommandType.StoredProcedure, not CommandType.{0}", commandType)); ValidateCommand ("DeriveParameters"); SybaseParameterCollection localParameters = new SybaseParameterCollection (this); localParameters.Add ("@P1", SybaseType.NVarChar, commandText.Length).Value = commandText; string sql = "sp_procedure_params_rowset"; Connection.Tds.ExecProc (sql, localParameters.MetaParameters, 0, true); SybaseDataReader reader = new SybaseDataReader (this); parameters.Clear (); object[] dbValues = new object[reader.FieldCount]; while (reader.Read ()) { reader.GetValues (dbValues); parameters.Add (new SybaseParameter (dbValues)); } reader.Close (); }
public SybaseCommand (string commandText, SybaseConnection connection, SybaseTransaction 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 SybaseParameterCollection (this); }
private SybaseCommand(string commandText, SybaseConnection connection, SybaseTransaction transaction, CommandType commandType, UpdateRowSource updatedRowSource, bool designTimeVisible, int commandTimeout, SybaseParameterCollection parameters) { this.commandText = commandText; this.connection = connection; this.transaction = transaction; this.commandType = commandType; this.updatedRowSource = updatedRowSource; this.designTimeVisible = designTimeVisible; this.commandTimeout = commandTimeout; this.parameters = new SybaseParameterCollection(this); for (int i = 0;i < parameters.Count;i++) this.parameters.Add(((ICloneable)parameters[i]).Clone()); }