Exemple #1
0
        // Command to fetch a single value
        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);
        }
Exemple #2
0
 // Command to execute Insert, Delete, Update Operations and return Output Parameters
 public object[] ExecuteNonQueryparam(CommandType commandType, string commandText)
 {
     this.idbCommand = DBManagerFactory.GetCommand(this.ProviderType);
     PrepareCommand(idbCommand, this.Connection, this.Transaction,
                    commandType, commandText, this.Parameters);
     idbCommand.ExecuteNonQuery();
     //idbCommand.Parameters.Clear();
     return(this.Parameters);
 }
Exemple #3
0
 // Fetch Data Using Datareader
 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);
 }
Exemple #4
0
 // Databse Begin Transaction
 public void BeginTransaction()
 {
     if (this.idbTransaction == null)
     {
         //idbTransaction = DBManagerFactory.GetTransaction(this.ProviderType);
         idbTransaction = DBManagerFactory.GetTransaction(this.Connection);
     }
     this.idbCommand.Transaction = idbTransaction;
 }
Exemple #5
0
 // Creating and opening a Databse connection based on the Provider Type
 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);
 }
Exemple #6
0
        // To Fetch data and return in a Dataset
        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);
        }
Exemple #7
0
 // Creating the numeber of parameters required for a Command
 public void CreateParameters(int paramsCount)
 {
     idbParameters = new IDbDataParameter[paramsCount];
     idbParameters = DBManagerFactory.GetParameters(this.ProviderType, paramsCount);
 }