修改后的datagridview数据更新到数据库 [英] modified datagridview data update to the database
本文介绍了修改后的datagridview数据更新到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谢谢.
解决方案
为此,可以采用以下过程.
在ADO.NET中,我们可以在断开连接的模型中工作.即,将数据库中的数据读入程序中的数据集,对数据集中的数据进行必要的修改,然后将数据写回到数据库中.
创建一个数据集.使用AddNewDataSource向导可以轻松创建Typed DataSet.这里提供了一个教程
http://www.mini.pw.edu.pl /~mossakow/materials/presentations/adonet.3.5/typed_datasets/index.html [用于从DataBase和使用反射将DataTable保存到数据库中 [ 解决方案
For this purpose the following procedure can be adopted.
In ADO.NET we can work in disconnected model. i.e. The data from the database is read into the DataSet in the program, required modification are done to the data in the DataSet and then the data is written back to the database.
Create a DataSet. Typed DataSet is easy to create using the AddNewDataSource wizard. A tutorial is given here
http://www.mini.pw.edu.pl/~mossakow/materials/presentations/adonet.3.5/typed_datasets/index.html[^]
Then the data is read to be read into the dataset, using TabeAdapters of the corresponding DataTables.
The DataTable are bound to the DataGridView, to show and modify the data.
Then the modified data is to be saved to the database.
A general purpose class to read and save the data is given in this Code Project article.
General purpose class to fill DataTable(s) from DataBase and to save DataTable(s) to DataBase using reflection[^]]
I think this may be helpful to you.
这篇关于修改后的datagridview数据更新到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文