winform_dataGridView更新问题,谢谢!
为什么这样可以,注释的那部分方法不行?出错。谢谢回答。
int j = dataGridView1.SelectedRows.Count;
int[] l = new int[j];
int i;
for (i = 0; i < j; i++)
{
l[i] = dataGridView1.SelectedRows[i].Index;
}
int k = 0;
while (k < j)
{
this.northwindDataSet.Customers.Rows[l[k]].Delete();
k++;
}
//this.customersTableAdapter.Update(this.northwindDataSet.Customers);
//int count = dataGridView1.SelectedRows.Count;
//for (int i = 0; i < count; i++)
//{
// this.northwindDataSet.Customers.Rows.RemoveAt(dataGridView1.SelectedRows[i].Index);
//}
//foreach (DataGridViewRow dr in dataGridView1.Rows)
//{
// if (dr.Selected)
// {
// this.northwindDataSet.Customers.Rows[dr.Index].Delete();
// }
//}
&