Ch16-03-03.aspx 以DataSet对象作为数据来源
' 在这里设置联机字符串的内容
Sub Page_Load(Obj As Object, e As EventArgs)
If Not IsPostBack Then
' 声明DataSet对象
Dim tSQL As String = "Select * From UserDatas"
Dim OBJDataSet As DataSet = New DataSet()
GetDataSet(OBJDataSet, tSQL)
ListBox1.DataSource = OBJDataSet.Tables("UserDatas").DefaultView
ListBox1.DataTextField = "UserName"
ListBox1.DataBind()
End If
End Sub
Sub Button1_Click(Obj As Object, e As EventArgs)
If ListBox1.SelectedIndex > -1 Then
Label1.Text = "用户选择:" & ListBox1.SelectedItem.Text
End if
End Sub
OnClick="Button1_Click" Runat="Server" />
BorderColor="#FF00FF" Runat="Server" />