public DataTable ExecuteDataTable(CommandType commandType, string commandText) { try { this.idbCommand = DBManagerFactory.GetCommand(this.ProviderType); PrepareCommand(idbCommand, this.Connection, this.Transaction, commandType, commandText, this.Parameters); IDbDataAdapter dataAdapter = DBManagerFactory.GetDataAdapter (this.ProviderType); dataAdapter.SelectCommand = idbCommand; DataSet dataSet = new DataSet(); dataAdapter.Fill(dataSet); idbCommand.Parameters.Clear(); if (dataSet.Tables.Count > 0) { return(dataSet.Tables[0]); } return(null); } catch (Exception) { throw; } }
public object ExecuteScalar(CommandType commandType, string commandText) { this.idbCommand = DBManagerFactory.GetCommand(this.ProviderType); PrepareCommand(idbCommand, this.Connection, this.Transaction, commandType, commandText, this.Parameters); object returnValue = idbCommand.ExecuteScalar(); idbCommand.Parameters.Clear(); return(returnValue); }
private IDbDataAdapter CreateCommandAndDataAdapter() { //Command and Adapter creation this.idbCommand = DBManagerFactory.GetCommand(this.ProviderType); IDbDataAdapter dataAdapter = DBManagerFactory.GetDataAdapter (this.ProviderType); return(dataAdapter); }
public IDataReader ExecuteReader(CommandType commandType, string commandText) { this.idbCommand = DBManagerFactory.GetCommand(this.ProviderType); idbCommand.Connection = this.Connection; PrepareCommand(idbCommand, this.Connection, this.Transaction, commandType, commandText, this.Parameters); this.DataReader = idbCommand.ExecuteReader(); idbCommand.Parameters.Clear(); return(this.DataReader); }
public void Open() { idbConnection = DBManagerFactory.GetConnection(this.providerType); idbConnection.ConnectionString = this.ConnectionString; if (idbConnection.State != ConnectionState.Open) { idbConnection.Open(); } this.idbCommand = DBManagerFactory.GetCommand(this.ProviderType); }
public DataSet ExecuteDataSet(CommandType commandType, string commandText) { this.idbCommand = DBManagerFactory.GetCommand(this.ProviderType); PrepareCommand(idbCommand, this.Connection, this.Transaction, commandType, commandText, this.Parameters); IDbDataAdapter dataAdapter = DBManagerFactory.GetDataAdapter(this.ProviderType); dataAdapter.SelectCommand = idbCommand; DataSet dataSet = new DataSet(); dataAdapter.Fill(dataSet); idbCommand.Parameters.Clear(); return(dataSet); }
public IDataReader ExecuteReader(CommandType commandType, string commandText) { if (this.Connection == null) { Open(); } this.idbCommand = DBManagerFactory.GetCommand(this.ProviderType); idbCommand.Connection = this.Connection; PrepareCommand(idbCommand, this.Connection, this.Transaction, commandType, commandText, this.Parameters); this.DataReader = idbCommand.ExecuteReader(); // TODO: only clear out parameters if none of the parameters are of type output //idbCommand.Parameters.Clear(); return(this.DataReader); }
public object ExecuteScalar(CommandType commandType, string commandText) { if (this.Connection == null) { Open(); } this.idbCommand = DBManagerFactory.GetCommand(this.ProviderType); PrepareCommand(idbCommand, this.Connection, this.Transaction, commandType, commandText, this.Parameters); object returnValue = idbCommand.ExecuteScalar(); // TODO: only clear out parameters if none of the parameters are of type output // idbCommand.Parameters.Clear(); return(returnValue); }
public int ExecuteNonQuery(CommandType commandType, string commandText) { try { this.idbCommand = DBManagerFactory.GetCommand(this.ProviderType); PrepareCommand(idbCommand, this.Connection, this.Transaction, commandType, commandText, this.Parameters); int returnValue = idbCommand.ExecuteNonQuery(); idbCommand.Parameters.Clear(); return(returnValue); } catch (Exception) { throw; } }
public DataSet ExecuteDataSet(CommandType commandType, string commandText) { if (this.Connection == null) { Open(); } this.idbCommand = DBManagerFactory.GetCommand(this.ProviderType); this.idbCommand.CommandTimeout = 0; PrepareCommand(idbCommand, this.Connection, this.Transaction, commandType, commandText, this.Parameters); IDbDataAdapter dataAdapter = DBManagerFactory.GetDataAdapter(this.ProviderType); dataAdapter.SelectCommand = idbCommand; DataSet dataSet = new DataSet(); dataAdapter.Fill(dataSet); // TODO: only clear out parameters if none of the parameters are of type output // idbCommand.Parameters.Clear(); return(dataSet); }
public DataSet SetDataSetForUpdate(CommandType commandType, string commandText) { try { this.idbCommand = DBManagerFactory.GetCommand(this.ProviderType); PrepareCommand(idbCommand, this.Connection, this.Transaction, commandType, commandText, this.Parameters); IDbDataAdapter dataAdapter = DBManagerFactory.GetDataAdapter (this.ProviderType); dataAdapter.SelectCommand = idbCommand; UpdateDataSet = new DataSet(); dataAdapter.Fill(UpdateDataSet); idbCommand.Parameters.Clear(); return(UpdateDataSet); } catch (Exception) { throw; } }