sqldataadapte da=new sqldataadapte ("select* from table ", conn);
datatable dt=new datatable();
da.Fill(dt);
datagrid.source=dt;
sqlcommandbuilder cbd=new sqlcommandbuilder(da);
da.update(dt);
Note:- if there is primary key in the table and u are accessing that primary
key in select command .then u can use sqlcommandbuilderwhich will
automatically generate the updtae insert and delete command.
if there is no primary key in table then u need to write ur own update
command.
在分布式的情况下,存在主键的时候,sqlCommangBuilder如果还使用insert的话,(可能)会发生冲突,但如果没有
主键的话,在提交虚拟表的时候,用户对表的更改需要自己查找,。。。。。。。。。。。。。。。。。。。