45fan.com - 路饭网

搜索: 您的位置主页 > 网络频道 > 阅读资讯:如何使用Dataset实现对Dropdownlist的赋值?

如何使用Dataset实现对Dropdownlist的赋值?

2016-09-05 09:04:09 来源:www.45fan.com 【

如何使用Dataset实现对Dropdownlist的赋值?

Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
'调出系部名称
dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim myCommand As New SqlDataAdapter("select * from [Department]", myConnection)

Dim ds As New DataSet()
myCommand.Fill(ds, "Department")
'将系部名称赋值给系部设置
D_Name.DataSource =ds.Tables("Department")
D_Name.DataTextField="D_Name"
D_Name.DataValueField ="D_ID"
D_Name.DataBind()
myConnection.close()
End sub

 

本文地址:http://www.45fan.com/a/question/72605.html
Tags: 实现 DataSet DropDownList
编辑:路饭网
关于我们 | 联系我们 | 友情链接 | 网站地图 | Sitemap | App | 返回顶部