从数据集更新数据库?
问题描述:
我想从我的数据集更新我的数据库。从数据集更新数据库?
mydataadapter = new MySqlDataAdapter("SELECT * FROM table0; SELECT * FROM table1; SELECT * FROM table2;", con);
myda.Fill(dataset);
//......
// for example I'm doing a change like this
ds.Tables[2].Rows[1][3] = "S";
//Then updating the database
MySqlCommandBuilder com = new MySqlCommandBuilder(mydataadapter);
mydataadapter.Update(dataset, "table2");
然后返回该错误
TableMapping['table2'] or DataTable 'table2' didn't find by Update.
你有什么建议吗?
我做到了,没有错误返回。但数据库dosn't不会改变。我可以添加executabletenquery等:S – Ases 2010-04-20 19:58:04
MySqlCommandBuilder com = new MySqlCommandBuilder(mydataadapter); 不是吗? – Ases 2010-04-21 18:32:02