public SADataReader ExecuteSPReader(string procedureName) { SADataReader reader; SACommand cmd = new SACommand(); this.Connect(); cmd.CommandTimeout = this.CommandTimeout; cmd.CommandText = procedureName; cmd.Connection = _connection; if (_transaction != null) { cmd.Transaction = _transaction; } cmd.CommandType = CommandType.StoredProcedure; this.CopyParameters(cmd); CommandBehavior behavior = CommandBehavior.Default; if (this.AutoCloseConnection) { behavior = behavior | CommandBehavior.CloseConnection; } if (_isSingleRow) { behavior = behavior | CommandBehavior.SingleRow; } reader = cmd.ExecuteReader(behavior); _parameterCollection = cmd.Parameters; cmd.Dispose(); return(reader); }
public void ExecuteSPDataSet(ref DataSet dataSet, string procedureName, string tableName) { SACommand cmd = new SACommand(); this.Connect(); SADataAdapter da = new SADataAdapter(); cmd.CommandTimeout = this.CommandTimeout; cmd.CommandText = procedureName; cmd.Connection = _connection; if (_transaction != null) { cmd.Transaction = _transaction; } cmd.CommandType = CommandType.StoredProcedure; this.CopyParameters(cmd); da.SelectCommand = cmd; da.Fill(dataSet, tableName); _parameterCollection = cmd.Parameters; da.Dispose(); cmd.Dispose(); if (this.AutoCloseConnection) { this.Disconnect(); } }
public void ExecuteSP(string procedureName) { SACommand cmd = new SACommand(); this.Connect(); cmd.CommandTimeout = this.CommandTimeout; cmd.CommandText = procedureName; cmd.Connection = _connection; if (_transaction != null) { cmd.Transaction = _transaction; } cmd.CommandType = CommandType.StoredProcedure; this.CopyParameters(cmd); cmd.ExecuteNonQuery(); _parameterCollection = cmd.Parameters; cmd.Dispose(); if (this.AutoCloseConnection) { this.Disconnect(); } }
public void Reset() { if (_parameters != null) { _parameters.Clear(); } if (_parameterCollection != null) { _parameterCollection = null; } }
public XmlReader ExecuteSPXmlReader(string procedureName) { SADataReader reader; SACommand cmd = new SACommand(); this.Connect(); cmd.CommandTimeout = this.CommandTimeout; cmd.CommandText = procedureName; cmd.Connection = _connection; if (_transaction != null) { cmd.Transaction = _transaction; } cmd.CommandType = CommandType.StoredProcedure; this.CopyParameters(cmd); reader = cmd.ExecuteReader(); _parameterCollection = cmd.Parameters; cmd.Dispose(); return(XmlReader.Create(reader.ToString())); }