ds.Rows.RemoveAt(this.BindingContext[ds].Position);(该行删除成功,在画面上)
//保存代码
public void save_data()
{
DataTable bb = new DataTable();
this.BindingContext[ds].EndCurrentEdit();
bb = ds.GetChanges(); 
if (bb!=null)
{
 if (MessageBox.Show(this,"您修改过数据确定要修改吗?","注意",MessageBoxButtons.YesNo,MessageBoxIcon.Error) == DialogResult.Yes)
  { OleDbCommandBuilder cc =new OleDbCommandBuilder(da);
    da.Update(ds);
    ds.AcceptChanges();
  }
  else
  {
               ds.RejectChanges();
   }
}

解决方案 »

  1.   

    还是那句话,GetChanges()是根据DataRow的RowStatus属性来判断DataTable是否修改过
    你用ds.Rows.RemoveAt()把Row直接删除了,而不是用Delete()方法的话
    ds所有的DataRow的RowStatus全部是未改动状态,GetChange()当然返回nullRemoveAt()方法是删除DataRow对象,而不是删除数据库的行.(应使用Delete()方法)
    ds.Rows.RemoveAt(this.BindingContext[ds].Position);(该行删除成功,在画面上)
    //改为
    ds.Rows[this.BindingContext[ds].Position].Delete();
      

  2.   

    试着在
    ds.Rows.RemoveAt(this.BindingContext[ds].Position);(该行删除成功,在画面上)
    前面加上下面一句试试..ds.AcceptChanges();
      

  3.   

    如果不行的话,可以试试zxkid的方法...DataRowState枚举中有一个为Deleted,MSDN上对它的说明是"该行已通过 DataRow 的 Delete 方法被删除。"要求用Delete来删除..