Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not (Me.IsPostBack) Then
SqlConnection1.Open()
SqlCommand1.CommandText = "Select au_id, au_lname from authors"
ListBox1.DataSource = SqlCommand1.ExecuteReader()
ListBox1.DataTextField = "au_lname"
ListBox1.DataValueField = "au_id"
ListBox1.DataBind()
SqlConnection1.Close()
End If
End Sub
If Not (Me.IsPostBack) Then
SqlConnection1.Open()
SqlCommand1.CommandText = "Select au_id, au_lname from authors"
ListBox1.DataSource = SqlCommand1.ExecuteReader()
ListBox1.DataTextField = "au_lname"
ListBox1.DataValueField = "au_id"
ListBox1.DataBind()
SqlConnection1.Close()
End If
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货