我有一个如下所示的 DataTable MyDT:
string MyConString = "SERVER=" + sConfig_hostname + ";" +
"DATABASE=" + sConfig_dbname + ";" +
"UID=" + sConfig_dbusername + ";" +
"PASSWORD=" + sConfig_dbpassword + ";Allow Zero Datetime=true;";
MySqlConnection connection = new MySqlConnection(MyConString);
string sQuery="Select * from Table";
connection.Open();
MySqlDataAdapter myDA = new MySqlDataAdapter(sQuery, connection);
myDA.SelectCommand.ExecuteNonQuery();
DataTable MyDT=new DataTable()// <- My DataTable
myDA.Fill(MyDT);
connection.Close();
...
...
// do something with MyDT
...
...
用 MyDT 做某事后,我想将它更新到数据库,我该怎么做?我已经在谷歌搜索页面,但几乎通过循环数据表进行更新。有没有办法在没有循环的情况下更新整个数据表?请帮忙!谢谢阅读