希望能有大神解惑,表中我已经把列名导进去了,是利用arraylist导入列名,现在我想把DGV里的数据导入到MDB的表中,怎么做?希望能有链接或者关键的代码
2条回答 默认 最新
- threenewbee 2015-04-21 07:19关注
foreach (var item in dgv.Rows)
{
string xxx = item.cells[0].value.tostring();
string yyy = item.cells[1].value.tostring();
string zzz = item.cells[2].value.tostring();
...
string sql = "insert 表(字段1, 字段2, ...) values ('" + xxx + "', '" + yyy + "' + '", '" + zzz + "') where id = " + ...;
OleDbCommand cmd = new OleDbCommand(sql, conn);
cmd.ExecuteScalar();
}本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报