C#把Datatable中重复的行删除后绑定DataGridView,发现没变,不清楚是什么情况,各位帮忙看看。代码如下:
for(int i=0;i<dt.rows.count;i++)
{
for(int j=0;j<dt.rows.count;j++)
{
if(dt.rows[j][2].tostring()==dt.rows[i][2].tostring())
{
dt.rows[j].delete();
dt.AccpetChanges();
}
}
}
datagridview1.datasource=dt;