【发布时间】:2014-06-22 13:58:10
【问题描述】:
我已经制作了组合框并添加了项目并从数据源函数 getBS() 加载数据返回绑定源。
comboBox1.Items.Insert(0, "ALL");
comboBox1.DataSource = getBS();
当我评论数据源时,它只显示项目“all”,但是当代码是这样时,它只显示数据但不显示属性“all”。有没有办法把这一切结合在一起?显示属性“全部”和其余数据?
【问题讨论】:
-
你能显示 getBS() 的定义吗?
-
con.Open(); cmd = new SqlCommand("uspPodruznicaSelect", con); da.SelectCommand = cmd; da.SelectCommand.CommandType = CommandType.StoredProcedure; da.Fill(dbtable); bsource.DataSource = 数据库表; con.Close();返回 bsource;
标签: c# combobox datasource items