private void btnDel_Click(object sender, EventArgs e)
{
int OKc = 0;
int NOc = 0;
List<int> selectRows;
selectRows = gridView1.GetSelectedRows().ToList();
if (selectRows.Count>0)
{
if (MessageBox.Show("您确定要删除吗?", "系统提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
foreach (int i in selectRows)
{
cs.CustomerID = gridView1.GetDataRow(i)["CustomerID"].ToString();
if (cs.Delete())
{
OKc++;
}
else
{
NOc++;
}
}
}
MessageBox.Show("成功删除"+OKc+"条数据,删除失败"+NOc+"条数据!", "系统提示");
}
else
{
MessageBox.Show("请选择数据后再进行操作!", "系统提示");
}
}
GridControl全选和反选
最新推荐文章于 2024-08-27 13:25:48 发布