日期:2014-05-17  浏览次数:20716 次

关于数据集的问题
我建了一个数据集deptDS,
sqldataadapter adp=new sqldataadapter;
adp.update(deptDS.tables[0]);
deptDS.acceptchanges

adp.update(deptDS.tables[0])这个为什么是更新的关联的数据库,而不是数据集呢,还有deptDS.acceptchanges这句话说是提交内存的dataset,什么时候要用,现在有点乱,请大神帮我理一下

------解决方案--------------------
这个是微软制定的,你是想更新多个表,最后循环一个一个的更新,还有就是要加上事务,deptDS.acceptchanges一般情况不用,因为你在做adp.update(Table)时,系统就自动就执行了Table.acceptchanges。除非你不保存的情况下又要提交对Table的更改