如何在datagridview中使用combobox更新数据库? [英] How update database with combobox in datagridview?

查看:127
本文介绍了如何在datagridview中使用combobox更新数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用了包含以下两个表的通用数据集(绑定两个DataGridView):

1.球队
2.团队成员

我在DataGridview(团队成员)单元中有组合框(与团队绑定).当我更改组合框选择时,我的两个DataGridView都将重置.

但是,我要使用所做的选择来更新数据库.

但是,如何?

问候!
Aman

Hi,

I have used a Generic DataSet (to bind two DataGridViews) containing following two tables:

1. Teams
2. Team Members

I have combobox (Binded with Team) in DataGridview (Team Member) Cell. When I change the combobox selection My both DataGridView get reset.

However, I want to update database with the selection made.

But, How?

Regards!
Aman

推荐答案


据我了解,您的问题是,您在两个DataGridViews中都使用了具有相同TableAdapter和BindingSource的相同数据集,如果这是正确的,那么这是您的解决方案,您只需复制数据集和TableAdapter,并且BindingSource允许假设它们将是dataset2和tableadapter2和bindingsource2现在将它们彼此分配,并为其分配一个DataGridView,现在当您更改其中一个时,另一个将不会更改

希望我能帮忙
:-)
Hi
From what I understood your problem is that you use the same dataset with the same TableAdapter and BindingSource in both the DataGridViews , if this is right then here is your solution you just have to make a copy of your dataset and TableAdapter and also the BindingSource lets assume they will be dataset2 and tableadapter2 and bindingsource2 now assign them to each others and assign one of the DataGridViews to them and now when you change one of them the other wont change

I hope I helped
:-)


这篇关于如何在datagridview中使用combobox更新数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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