将Datagridview更新到数据库 [英] Update Datagridview to the database

查看:216
本文介绍了将Datagridview更新到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个有关将datagridview更新到数据库的查询.
我对表单有一个datagridview,其中填充了提供datatable作为源.
现在,我要编辑和更新相同的数据网格.
它正在正确编辑,但是在更新时没有错误,并且数据库也相同.
我在表单上使用了数据集,bindingsource和dataadapter.

如果我错了,请指导我.

谢谢.
HBK

Hello to all,

I have a query regarding updating datagridview to database.
I have a datagridview to the form, which filled providing datatable as a source.
Now I want to edit and update the same datagrid.
It is editing properly but at the time of update there is no error and database is also the same.
I have used dataset , bindingsource and dataadapter on the form.

Please guide me if i''m wrong.

Thanks in advt.
HBK

推荐答案

VB DataGridView自动将更新保存到绑定数据库 [ ^ ]可能会有所帮助您出来.
VB DataGridView Automatically Saving Updates to a Bound Database[^] could probably help you out.


请告诉您您正在使用哪个数据库?
Please tell, which database you are using?


您好,您看,
我在表单上使用了数据集,bindingsource和dataadapter."

这些API不会跟踪dataGridView中发生的情况.这些仅用于检索数据.如果要在编辑dataGridView之后保存数据,则必须自己手动编写逻辑.为此,请参阅与dataGridView关联的事件.



在这方面,我的建议是离开旧的ADO .Net(您正在使用的技术),然后尝试新的实体框架.这样可以在后端数据库执行自动更新,将所有更改保留在上下文中.

为此,请尝试以下链接:

http://www.codeproject.com/KB/database/IntroEntityFramework3.aspx

希望这会有所帮助,祝你好运!
Look man, as you say,
"I have used dataset , bindingsource and dataadapter on the form."

These APIs do not keep track of what is happening in the dataGridView. These are just used to retrieve data. If you want to save data after editing the dataGridView, you have to write the logic manually by yourself. For this please see the events associated with dataGridView.

OR

My suggestion in this regard is to leave the old ADO .Net(technology you are using) and try the new Entity Framework. This can perform automatic updates at the back end database keeping all the changes in the context.

For this, try this link:

http://www.codeproject.com/KB/database/IntroEntityFramework3.aspx

Hope this will help, Good Luck!


这篇关于将Datagridview更新到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆