根据主健到dataset中去找
object[]findTheseVals = new object[主键数];
findTheseVals[0]=grid中主键1值;
findTheseVals[1]=grid中主键2值;
....
foundRow = dataset.Tables[0].Rows.Find(findTheseVals);
object[]findTheseVals = new object[主键数];
findTheseVals[0]=grid中主键1值;
findTheseVals[1]=grid中主键2值;
....
foundRow = dataset.Tables[0].Rows.Find(findTheseVals);
dataview中获得的数据与datagrid经过排序后是一一对应的然后通过this.dataview[this.currentCell.rownum]得到
的便是你所看到的数据
this.datagrid.DataSource = dataSet.Tables[0].DefaultView;
DefaultView的排序就会根据datagrid的排序.
int rowIndex = this.dataGrid.CurrentRowIndex;
//get id value
this.dataSet.Tables[0].select( "filter" )
// select dataRow from dataSet
这样做你的修改就不会受到排序的影响,
不过略麻烦一些