DataGridView中做的数据改变会反映到它所绑定的DataTable里,最后使用SqlDataAdapter的Update方法,把修改反映到数据库中

解决方案 »

  1.   

    1.只要绑定了就会2.至于调用update方法 你只要指定了da相应的command即可或者自己写 或者使用commandBuilder来生成command。
      

  2.   

    for (int i = 0; i < dataGridView1.Rows.Count-1; i++)
                {
                    dt.Rows[i].ItemArray[0] = dataGridView1.Rows[i].Cells[0].Value;
                    dt.Rows[i].ItemArray[1] = dataGridView1.Rows[i].Cells[1].Value;
                    dt.Rows[i].ItemArray[2] = dataGridView1.Rows[i].Cells[2].Value;
                    dt.Rows[i].ItemArray[3] = dataGridView1.Rows[i].Cells[3].Value;
                }