dataGridView1保存更改,提示Update 无法找到 TableMapping['tb_stand']请哪位高手指点一下呀。 public void frm_setStand_Load(object sender, EventArgs e)
{
string connString = "Server=.;User Id=sa;Pwd=000000;DataBase=myDb_gzcf";
SqlConnection conn = new SqlConnection(connString);
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
}
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
int row = da.Update(ds, "tb_stand"); //此处提示Update 无法找到 TableMapping['tb_stand'] 或 DataTable“tb_stand”。
MessageBox.Show("更新完成");
}
{
string connString = "Server=.;User Id=sa;Pwd=000000;DataBase=myDb_gzcf";
SqlConnection conn = new SqlConnection(connString);
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
}
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
int row = da.Update(ds, "tb_stand"); //此处提示Update 无法找到 TableMapping['tb_stand'] 或 DataTable“tb_stand”。
MessageBox.Show("更新完成");
}
SqlDataAdapter da = new SqlDataAdapter(Sqltext, this.ss);
SqlCommandBuilder thisbuilder = new SqlCommandBuilder(da);
da.SelectCommand = thisbuilder .GetInsertCommand();
da.UpdateCommand = thisbuilder .GetUpdateCommand();
da.DeleteCommand = thisbuilder .GetDeleteCommand();
da.Fill(ds);
da.Update(ds,table);
SqlConnection conn = new SqlConnection(connString);
SqlDataAdapter da = new SqlDataAdapter(sql,conn);
SqlCommandBuilder thisbuilder = new SqlCommandBuilder(da);
da.Fill(ds, "tb_stand");//此处我改了,没有提示错误,但保存不进数据。
ds.AcceptChanges();
ds.Tables[0].TableName = "tb_stand";