如何在组合框中绑定来自Sql DB的数据并在2个组合框之间建立关系 [英] How Can I binding data from Sql DB in combo box and make relation between 2 combo boxes

查看:45
本文介绍了如何在组合框中绑定来自Sql DB的数据并在2个组合框之间建立关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在组合框中绑定来自Sql DB的数据并在2个组合框之间建立关系......我的意思是,当我从中选择国家/地区时,一个组合框成员取决于在另一个组合框中选择的例如country和citities第一个组合框只出现(第二个组合框中这个国家的citities )使用c #Windows应用程序...最好的问候

How Can I binding data from Sql DB in combo box and make relation between 2 combo boxes ... I mean that one combo box members depends on which selected on the other combo box for example country and citities when i select country from first combo box appears only (citities of this country on the second combo box) using c# Windows application ... best regards

推荐答案

对于第一个组合框,您通常会获取数据并将其绑定到组合框。你绑定另一个在第一个的SelectedValueChanged事件中,你获得第二个数据,取决于第一个的SelectedValue。



如果这有帮助请花时间接受解决方案。谢谢。
For the first combobox you normally get the data and bind it to the combobox. You bind the other one in SelectedValueChanged event of the first one in which you get the data for the second depending on SelectedValue of the first.

If this helps please take time to accept the solution. Thank you.


这篇关于如何在组合框中绑定来自Sql DB的数据并在2个组合框之间建立关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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