下拉菜单数据绑定(vb.net)
怎么样把数据绑定 代码如下 请大家添上·
Dim strsql2 As New StringBuilder( " ")
strsql2.Length = 0
strsql2.Append( "select ")
strsql2.Append( "VAL01 from ")
strsql2.Append( "HDAW_M_SYSTEMCTL ")
strsql2.Append( "where ")
strsql2.Append( " KEY_NO= ")
strsql2.Append( " ' ")
strsql2.Append( "A06 ")
strsql2.Append( " ' ")
dim ds as dataset
ds = DataCenter.GetDataSet(strsql2.ToString())
If Not IsPostBack Then
控件名字叫selGhion请大家帮忙
End If
------解决方案--------------------selGhion.datasource=ds
selGhion.databind
------解决方案--------------------dt = mydb.GetDataTable( "usp_renwuml_list ", CommandType.StoredProcedure)
mydb.CloseConn()
dv = dt.DefaultView
If dt.Rows.Count > 0 Then
dv.Sort = "lujing "
End If
dgmulu.DataSource = dv
dgmulu.DataBind()
------解决方案--------------------dgmulu.DataTextField = "显示字段 ";
dgmulu.DataValueField = "值字段 ";
dgmulu.DataSource = dv
dgmulu.DataBind()
------解决方案--------------------Dim strsql2 As New StringBuilder( " ")
strsql2.Length = 0
strsql2.Append( "select ")
strsql2.Append( "VAL01 from ")
strsql2.Append( "HDAW_M_SYSTEMCTL ")
strsql2.Append( "where ")
strsql2.Append( " KEY_NO= ")
strsql2.Append( " ' ")
strsql2.Append( "A06 ")
strsql2.Append( " ' ")
dim ds as dataset
ds = DataCenter.GetDataSet(strsql2.ToString())
If Not IsPostBack Then
selGhion.DataSource=ds.Tables(0)
selGhion.DataTextField= "字段1 "
selGhion.DataValueField= "字段2 "
selGhion.DataBind()
End If