首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

怎么在listbox中一行显示两个值

2012-03-26 
如何在listbox中一行显示两个值我要在Listbox显示一行两个值格式为bc_bindcalled|bc_password,如:9856845|

如何在listbox中一行显示两个值
我要在Listbox显示一行两个值格式为bc_bindcalled|bc_password,如:9856845|4578,应该怎么做呢,原来的代码如下
  Dim cn As MySqlConnection
  cn = obj.get_sql_cn
  Dim strsql As String = "select * from e_bindcalled where bc_acctid=9856845"

  Dim ap As New MySqlDataAdapter(strsql, cn)
  Dim ds As New DataSet
  ap.Fill(ds, "e_bindcaller")

  cbo_reg_list.DataSource = ds.Tables(0).DefaultView
  cbo_reg_list.DataValueField = "bc_id"
  cbo_reg_list.DataTextField = "bc_bindcalled"
  cbo_reg_list.DataBind()

  If cn.State = ConnectionState.Open Then cn.Close()
  ap.Dispose()
  cn.Dispose()

[解决办法]
改一下sql就行了
select bindcalled +'|'+bc_password as bc_id from e_bindcalled where bc_acctid=9856845
[解决办法]

SQL code
 select bc_bindcalled + ' ¦ '+bc_password  as bc_id from  e_bindcalled where bc_acctid=9856845
[解决办法]
bc_bindcalled + ' ¦ '+bc_password
----------------------------------->
cast(bc_bindcalled as string) + ' ¦ '+cast(bc_password as string)

热点排行