datagridview更新到MySQL,修改后的datagridview数据更新到数据库

hi

I am new in .net so please help me i stucked,I have a datagridview and i made some changes to it after that whenever i clicked on the update button the datagridview data should be updated in the database so that next when i want to get the values from the database the modified data will come.

Thanks.

解决方案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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值