Пример #1
0
        public override DataTable ReadAsDataTable()
        {
            DataTable table;

            try
            {
                this.BeginExecute();
                this.InitPageCount();
                if (base.RecordCount > 0)
                {
                    string queryCommand = this.GetQueryCommand();
                    using (DbCommandWrapped wrapped = base.DbHelper.CreateDbCommandWrapped(queryCommand.ToString(), base.Condition.Parameters))
                    {
                        DataSet ds = new DataSet();
                        using (DbDataAdapter adapter = base.DbHelper.CreateDbDataAdapter(wrapped.Command))
                        {
                            wrapped.FillDataSet(adapter, ds);
                            return((ds.Tables.Count > 0) ? ds.Tables[0] : null);
                        }
                    }
                }
                table = null;
            }
            finally
            {
                this.EndExecute();
            }
            return(table);
        }
Пример #2
0
 protected void FillDataSet(DataSet dataset, DbCommandWrapped command)
 {
     using (command)
     {
         DateTime now = DateTime.Now;
         using (DbDataAdapter adapter = this.CreateDbDataAdapter(command.Command))
         {
             command.FillDataSet(adapter, dataset);
         }
         this.ProcessSlowCommandLog(command.Command, now, DateTime.Now);
     }
 }