开发者

Updating Database From Dataset?

I wanna update my database from my dataset.

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 = n开发者_StackOverflow社区ew MySqlCommandBuilder(mydataadapter);
mydataadapter.Update(dataset, "table2");

then it returns this error

TableMapping['table2'] or DataTable 'table2' didn't find by Update.

Do you have any advice?


The DataAdaptor does not know about table2, only a 3rd recordset (loaded into ds.Tables[2])

You need a table mapping to do this.

Edit: You have an UpdateCommand, right?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜