datagridview 数据处理方法 修改 删除 添加 下拉类表 弹出窗口
selectindex = e.RowIndex;
}
private void dataGridView1_CellValueChanged(object sender,
DataGridViewCellEventArgs e)
{
int mycellindex = e.RowIndex;
//MessageBox.Show(dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString());
if (dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString() == "" || dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString() == null)
MessageBox.Show("用户ID不能为空!!!");
else intindex[mycellindex % 20] = mycellindex;
// MessageBox.Show(mycellindex.ToString());
}
int pagenumber = 0;
int pagesum = 0;
int pagesize=2; //每页的条目数
private void button7_Click(object sender, EventArgs e) //显示下一页内容 {
DataOperate dataoperate = new DataOperate();
int pageindex =0 ; //已经显示的条目数
string strSql=null;
if (pagenumber != pagesum)
{
pageindex = pagenumber * 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 if (pagenumber != 1)
{
pageindex = (pagenumber - 1) * 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))";