datagridview 数据处理方法 修改 删除 添加 下拉类表 弹出窗口
string mysql = "delete from user_tb1 where ID=" + myid.ToString(); DataOperate dataoperate = new DataOperate(); dataoperate.getCom(mysql);
MessageBox.Show("删除数据成功");
//加载数据
mysql = "select * from sql3 ";
DataSet ds = dataoperate.getDs(mysql, "sql3");
dataGridView1.DataSource = ds.Tables[0];
/* //获取总页码 SELECT Count(id) AS number1 FROM user_tb1;
mysql = "SELECT Count(id) AS number1 FROM user_tb1 ";
DataSet ds = dataoperate.getDs(mysql, "user_tb1");
int indexsum = int.Parse(ds.Tables[0].Rows[0][0].ToString());
if (indexsum % pagesize == 0)
label5.Text = (indexsum / pagesize).ToString();
else
label5.Text = (indexsum / pagesize + 1).ToString();
pagesum = int.Parse(label5.Text);
//显示当前页面
try
{
button5_Click(sender, e); //刷新当前页面
}
catch (Exception)
{
throw;
}
*/
}
//
}
}
弹出窗口代码
using System;