コード例 #1
0
        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;
            }
        }
コード例 #2
0
        private IDbDataAdapter CreateCommandAndDataAdapter()
        {
            //Command and Adapter creation
            this.idbCommand = DBManagerFactory.GetCommand(this.ProviderType);
            IDbDataAdapter dataAdapter = DBManagerFactory.GetDataAdapter
                                             (this.ProviderType);

            return(dataAdapter);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: DBManager.cs プロジェクト: kanakamedala82/Meeting
        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);
        }
コード例 #5
0
 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;
     }
 }