datagridview 数据处理方法 修改 删除 添加 下拉类表 弹出窗口
}
else strSql = "select top " + pagesize.ToString() + " * from user_tb1 ";
//MessageBox.Show(strSql);//调试使用
DataSet ds = dataoperate.getDs(strSql, "user_tb1");
dataGridView1.DataSource = ds.Tables[0];
dataGridView1.Columns[0].ReadOnly = true; //列不可编写
//显示当前的页数
if (pagenumber < pagesum)
pagenumber = pagenumber + 1;
else
pagenumber = pagesum;
label2.Text = pagenumber.ToString();
}
private void button6_Click(object sender, EventArgs e)
{
DataOperate dataoperate = new DataOperate();
int pageindex = 0; //已经显示的条目数
string strSql = null;//
if ((pagenumber - 2) > 0)
{
pageindex = (pagenumber - 2) * pagesize;////已经显示的条目数 strSql = "SELECT TOP " + pagesize.ToString() + " * FROM user_tb1 WHERE id>(select max(id) from (select top " + pageindex.ToString() + " id from user_tb1 order by id))";
}
else strSql = "select top " + pagesize.ToString() + " * from user_tb1 ";
//MessageBox.Show(strSql);//调试使用