学习C#的时候碰上下面的代码,不知道什么意思,请各位指点指点。protected BindingManagerBase bmData;public override void SaveForUpdata()
{
int row = DataGrid.CurrentCell.RowNumber;
DataGrid.CurrentCell = new DataGridCell((row + 1)% bmData.Count,0);
if(dataSet.HasChanges)
sqlDataAdapter.Updata(dataSet);
}最好是能详细解释一下
DataGrid.CurrentCell = new DataGridCell((row + 1)% bmData.Count,0);
是什么意思!
{
int row = DataGrid.CurrentCell.RowNumber;
DataGrid.CurrentCell = new DataGridCell((row + 1)% bmData.Count,0);
if(dataSet.HasChanges)
sqlDataAdapter.Updata(dataSet);
}最好是能详细解释一下
DataGrid.CurrentCell = new DataGridCell((row + 1)% bmData.Count,0);
是什么意思!
DataGridCell((row + 1)% bmData.Count,0);//第(row + 1)% bmData.Count行,第1列
int row = DataGrid.CurrentCell.RowNumber;
DataGrid.CurrentCell = new DataGridCell((row + 1)% bmData.Count,0);
这两句似乎删掉也没什么问题啊。为什么要写这两句呢,这两句在这里到底起着什么作用呢?
int row = DataGrid.CurrentCell.RowNumber;
//设置更新后光标所在的单元格
DataGrid.CurrentCell = new DataGridCell((row + 1)% bmData.Count,0);
//下面2句更新数据库数据
if(dataSet.HasChanges)
sqlDataAdapter.Updata(dataSet);