DataGridView与Combobox过滤其他Combobox(级联组合框)

编程入门 行业动态 更新时间:2024-10-10 07:21:44
本文介绍了DataGridView与Combobox过滤其他Combobox(级联组合框)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想使用datagridview控件将costomer数据保存或更新到TblCustomer表中。 Datagridview中的ComboCountry必须过滤Combocity如果selectedindexchanges 两个组合必须具有id值和显示值。 我找到了一些关于级联组合框的代码,但无法做到。 任何人都可以给我看正确的代码。 谢谢。 我也不知道哪种方式更好地添加新记录: 1.添加10个empyt行,填充它们并按保存按钮 2. at datagridview的新行结束,填写新客户并按下键然后自动将数据保存到表格。(对不起我的英语不好) TblCustomer表有4列 CustomerId为int CustomerName为nvarchar CountryId为int CityId as int 数据示例: 1,Custo mer A,1,10 2,客户B,2,15 TblCountry表: CountryId为int 国家为nvarchar 数据示例: 1,美国 2,TURKEY TblCity表: CityId为int CountryId为int City as nvarchar 数据示例: 10,1,Kansas 15,2,Istanbul

I want to use datagridview control to save or update costomer data into TblCustomer table. ComboCountry in Datagridview must filter Combocity if selectedindexchanges both combos must have id value and display value. I found some codes about cascading comboboxes but couldnt do it. Can anyone show me the correct code. Thanks. I also dont know which way is better to add new records: 1. add 10 empyt rows, fill them and press save button 2. at the end of the datagridview's new line, fill new customer and press down key then automatically saves the data to table.(sorry for my poor English) TblCustomer Table has 4 columns CustomerId as int CustomerName as nvarchar CountryId as int CityId as int data example: 1, "Customer A", 1, 10 2, "Customer B", 2, 15 TblCountry Table: CountryId as int Country as nvarchar data example: 1, "USA" 2, "TURKEY" TblCity Table: CityId as int CountryId as int City as nvarchar data example: 10, 1, "Kansas" 15, 2, "Istanbul"

推荐答案

参考 - 在C-Sharp.Net中层叠组合框 [ ^ ]。 关于更新,如果你可以立即更新它会很好。如果你用down键一个接一个地做,那就更复杂了,数据库上的负载会更多。 Refer - Cascading ComboBox in C-Sharp.Net[^]. And about the update, if you can update at once it would be good. If you do one by one with down key, it would be more complex and the load on database would be more.

你好, 参考: 1) Asp Gridview中的级联下拉列表示例 2)级联组合框

更多推荐

DataGridView与Combobox过滤其他Combobox(级联组合框)

本文发布于:2023-11-13 04:38:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1583452.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:组合   级联   DataGridView   Combobox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!