Esempio n. 1
0
        public DataSet ExecutePagedDataSet(string CmdText, int intStart, int intMaxRec, string strTable, CommandType CmdType, out int totalRecords)
        {
            try
            {
                MySqlDataAdapter Adaptergrid;
                if (CmdType == CommandType.Text)
                {
                    Adaptergrid = new MySqlDataAdapter(CmdText, Con);
                    Adaptergrid.SelectCommand.CommandType = CmdType;
                }
                else
                {
                    Adaptergrid               = new MySqlDataAdapter();
                    this.Cmd.CommandText      = CmdText;
                    this.Cmd.CommandType      = CmdType;
                    this.Cmd.Connection       = this.Con;
                    Adaptergrid.SelectCommand = this.Cmd;
                }
                this.OpenConnection();
                DataSet   ds = new DataSet();
                DataTable dt = new DataTable();
                Adaptergrid.Fill(ds, intStart, intMaxRec, strTable);
                Adaptergrid.Fill(dt);
                totalRecords = dt.Rows.Count;

                this.CloseConnection();
                return(ds);
            }
            catch (Exception e)
            {
                totalRecords = 0;
                throw (e);
            }
        }
Esempio n. 2
0
        public DataSet ExecuteTransactionDataSet(string CmdText, CommandType CmdType)
        {
            try
            {
                MySqlDataAdapter Adaptergrid;
                if (CmdType == CommandType.Text)
                {
                    Adaptergrid = new MySqlDataAdapter(CmdText, this.Con);
                    Adaptergrid.SelectCommand.Transaction = this.Trans;
                    Adaptergrid.SelectCommand.CommandType = CmdType;
                }
                else
                {
                    Adaptergrid               = new MySqlDataAdapter();
                    this.Cmd.CommandText      = CmdText;
                    this.Cmd.CommandType      = CmdType;
                    this.Cmd.Transaction      = this.Trans;
                    this.Cmd.Connection       = this.Con;
                    Adaptergrid.SelectCommand = this.Cmd;
                }
                DataSet ds = new DataSet();

                Adaptergrid.Fill(ds);
                return(ds);
            }
            catch (Exception e)
            {
                throw (e);
            }
        }