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(); }
void Close() { if (transaction != null && transaction.IsOpen) { transaction.Rollback(); } if (dataReader != null) { if (tds != null) { tds.SkipToEnd(); } dataReader = null; } if (tds != null && tds.IsConnected) { if (pooling && tds.Pooling) { if (pool != null) { pool.ReleaseConnection(tds); } } else if (tds != null) { tds.Disconnect(); } } if (tds != null) { tds.TdsErrorMessage -= new TdsInternalErrorMessageEventHandler(ErrorHandler); tds.TdsInfoMessage -= new TdsInternalInfoMessageEventHandler(MessageHandler); } ChangeState(ConnectionState.Closed); }