private void MulDelete()
{
long[] long_id = new long[100];
int[] int_id = new int[100];
int k = 0;
for (int i = 0, mk = 0; i < dataGridv_AdminIma.Rows.Count; i++, mk++)//循环遍历DataGridView控件中的每一行
{
if (dataGridv_AdminIma.Rows[i].Selected == true)
{
string s = string.Empty;
try
{
s = dataGridv_AdminIma.Rows[i].Cells[0].Value.ToString();
}
catch (Exception)
{
s = string.Empty;
}
if (s != string.Empty)
{
//ExcisionData(s);//执行删除操作
long_id[k] = Convert.ToInt64(s);
int_id[k] = mk;
k++;
mk--;
}
}
}
bool Resualt = BLL.Delete(long_id, k); //对数据库批量删除操作
if (Resualt == false)
{
MessageBox.Show("删除失败.", "系统提示");
}
for (int j = 0; j < k; j++)
{
dataGridv_AdminIma.Rows.RemoveAt(int_id[j]);//移除处于选定状态的记录
}
}