OleDbDataAdapter adp_product =new OleDbDataAdapter("select * from [product] ",conn);
            
adp_product.Fill(ds,"dt_product");

OleDbCommandBuilder cb_product=new OleDbCommandBuilder(); //增加数据
DataRow  newRow;
newRow=ds.Tables["dt_product"].NewRow();newRow["pid"]  =  textBox1.Text.Trim();ds.Tables["dt_product"].Rows.Add(newRow);
adp_product.Update(ds,"dt_product");
最后一句出错,请问是怎么回事?

解决方案 »

  1.   

    有一个方法没有执行吧。EndCurrentEdit()
      

  2.   

    不需要吧,在sqlserver下没问题啊,难道是access特需的?
      

  3.   

    OleDbDataAdapter的UpdateCommand 没有绑定OleDbCommandBuilder的UpdateCommand()吧。
      

  4.   

    OleDbCommandBuilder cb_product=new OleDbCommandBuilder(adp_product);
    还是不行
      

  5.   

    1.OleDbCommandBuilder cb_product=new OleDbCommandBuilder(adp_product);
    2.select * from [product],你的product表里可能有的字段命名成系统关键字了,改成select [id],[name],....,然后再试一下!