Exemple #1
0
        private void ExecuteSQL(Boolean isPagerSQL)
        {
            DbHelper db = new DbHelper(conString, true);
            if (isPagerSQL)
            {
                try
                {
                    dataGridView1.DataSource = db.ExecuteSQL(rPagerSql.Text);
                }
                catch (Exception error)
                {
                    addErrList("获取分页数据SQL执行出错:" + "\n\r" + error.Message);
                }

                try
                {
                    dataGridView2.DataSource = db.ExecuteSQL(rSumSql.Text);
                }
                catch (Exception error)
                {
                    addErrList("获取合计数据SQL执行出错:" + "\n\r" + error.Message);
                }

                label4.Text = "";
                try
                {
                    label4.Text = "总行数为:" + db.ExecuteIntSQL(rRecordCountSql.Text).ToString();
                }
                catch (Exception error)
                {
                    addErrList("获取总行数SQL执行出错:" + "\n\r" + error.Message);
                }
            }
            else
            {
                dgvNoPageSql.DataSource = db.ExecuteSQL(rCommonSql.Text);
            }
        }