我有这段代码:
OleDbDataAdapter dataAdapter = new OleDbDataAdapter("SELECT col1, col2 "
+ "FROM tab1",
connection);
我希望能够这样做:
dataAdapter.UpdateCommand = new OleDbCommand(
"UPDATE tab1 SET col1 = col1*2, col2 = 300"
+ "WHERE col1 = 5", connection);
如何做到这一点?
答案 0 :(得分:2)
就这样使用它:
var cmd = new OleDbCommand("UPDATE tab1 SET col1 = col1*2, col2 = 300 WHERE col1 = 5", connection);
cmd.ExecuteNonQuery();
您不需要数据适配器。