bind_Member.EndEdit()----将编辑由控件提交到后台的datatable
RowState ---已经行的不同状态进行不同的后台处理,新增、修改、删除
dataTable = bind_Member.DataSource as DataTable;
if (dataTable.GetChanges() == null)
{ return; }
foreach (DataRow item in dataTable.GetChanges().Rows)
{
if (item.RowState == DataRowState.Added)
{
this.Text += "new-" + item[3, DataRowVersion.Current].ToString();
}
else if (item.RowState == DataRowState.Modified)
{ this.Text += "edit-" + item[3, DataRowVersion.Original].ToString() + "--" + item[3, DataRowVersion.Current].ToString(); }
else if (item.RowState == DataRowState.Deleted)
{ this.Text += "delete-" + item[3, DataRowVersion.Original].ToString(); }
}
//dataTable.RejectChanges();//放弃修改
dataTable.AcceptChanges();//提交修改