Ejemplo n.º 1
0
 private void TSBFirstPage_Click(object sender, EventArgs e)
 {
     dataGridView_Archive_Print.DataSource = Class_SQL_Deal.DataTable_Query(SQL_Query, TableName, 0, PrintRows);
     StartRows              = 0;
     Now_Pages              = 1;
     Get_RowClick           = -1;
     TStripLabel_Count.Text = Convert.ToString(Now_Pages);
 }
Ejemplo n.º 2
0
 private void TSBLastPage_Click(object sender, EventArgs e)
 {
     if (All_Pages > 0)
     {
         Get_RowClick = -1;
         Now_Pages    = All_Pages;
         StartRows    = (All_Pages - 1) * PrintRows;
         dataGridView_Archive_Print.DataSource = Class_SQL_Deal.DataTable_Query(SQL_Query, TableName, StartRows, PrintRows);
         TStripLabel_Count.Text = Convert.ToString(Now_Pages);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 查询Tables
        /// </summary>
        private void PrintDatas(DataGridView Get_DataGridView, string AllRows_SQL, string Query_SQL, string TableName)
        {
            Set_Page_Button(0);
            Class_SQL_Deal.Open_Connection();
            Get_DataGridView.DataSource = null;
            //
            Get_DataGridView.Columns.Clear();
            Get_DataGridView.Rows.Clear();
            //
            All_Rows = Class_SQL_Deal.Query_AllRows("Archive_Table", AllRows_SQL);
            //
            if (All_Rows == 0)//只有一页
            {
                #region 查不到信息时提示信息

                Get_DataGridView.Columns.Add("Message", "");
                Get_DataGridView.Rows.Add("亲,查询不到信息哦!");

                #endregion

                TSLPagesPrint.Text = "0";

                TStripLabel_Count.Text = "0";

                return;
            }
            else if (All_Rows > 0 && All_Rows <= PrintRows)
            {
                Get_DataGridView.DataSource = Class_SQL_Deal.DataTable_Query(Query_SQL, TableName, StartRows, PrintRows);
                TSLPagesPrint.Text          = "1";
                TStripLabel_Count.Text      = Convert.ToString(Now_Pages);
                return;
            }
            else
            {
                JudgeElse = All_Rows % PrintRows;//整页
                if (JudgeElse == 0)
                {
                    Set_Page_Button(1);
                    All_Pages = All_Rows / PrintRows;
                    Get_DataGridView.DataSource = Class_SQL_Deal.DataTable_Query(Query_SQL, TableName, StartRows, PrintRows);
                    TSLPagesPrint.Text          = Convert.ToString(All_Pages);
                    TStripLabel_Count.Text      = Convert.ToString(Now_Pages);
                }
                else//一页半的情况
                {
                    Set_Page_Button(1);
                    All_Pages = All_Rows / PrintRows + 1;
                    Get_DataGridView.DataSource = Class_SQL_Deal.DataTable_Query(Query_SQL, TableName, StartRows, PrintRows);
                    TSLPagesPrint.Text          = Convert.ToString(All_Pages);
                    TStripLabel_Count.Text      = Convert.ToString(Now_Pages);
                }
            }
        }