private void Orderinfo_Load(object sender, EventArgs e)
        {   
            
         
            dgvClothInfo.DataSource = adcolor.getOrderColor("tb_color").Tables[0].DefaultView;
            this.SetdgvClothInfoHeadText();
                    }  public DataSet getOrderColor(string tbName_trueName)
        {
            return (data.RunProcReturn("select color,amount from tb_color  ", tbName_trueName));
        }
我修改dgvClothInfo中的数据后将整个的dgvClothInfo的数据一次插入另外一张表中(ordercolors)   

解决方案 »

  1.   

    用DataAdapter.Update   方法   
        
      public   DataSet   CreateCmdsAndUpdate(DataSet   myDataSet,string   myConnection,string   mySelectQuery,string   myTableName)     
      {   
              OleDbConnection   myConn   =   new   OleDbConnection(myConnection);   
              OleDbDataAdapter   myDataAdapter   =   new   OleDbDataAdapter();   
              myDataAdapter.SelectCommand   =   new   OleDbCommand(mySelectQuery,   myConn);   
              OleDbCommandBuilder   custCB   =   new   OleDbCommandBuilder(myDataAdapter);   
        
              myConn.Open();   
        
              DataSet   custDS   =   new   DataSet();   
              myDataAdapter.Fill(custDS);   
        
              //code   to   modify   data   in   dataset   here   
        
              //Without   the   OleDbCommandBuilder   this   line   would   fail   
              myDataAdapter.Update(custDS);   
        
              myConn.Close();   
        
              return   custDS;   
        }