Ch16-03-02.aspx 以DataReader对象作为数据来源
Sub Page_Load(Obj As Object, e As EventArgs)
If Not IsPostBack Then
Dim DSN As String
Dim tSQL As String = "Select * From UserDatas"
Dim OBJConn As OleDbConnection
DSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("/ASP/chap14/ASP.NET网页数据库.mdb") & ";"
OBJConn = New OleDbConnection(DSN)
OBJConn.Open()
Dim OBJCmd As OleDbCommand = New OleDbCommand(tSQL, OBJConn)
RadioList1.DataSource = OBJCmd.ExecuteReader()
RadioList1.DataTextField = "UserName"
RadioList1.DataBind()
OBJConn.Close()
End If
End Sub
Sub Button1_Click(Obj As Object, e As EventArgs)
Label1.Text = "用户选择:" & RadioList1.SelectedItem.Text
End Sub
OnClick="Button1_Click" Runat="Server" />
BorderColor="#FF00FF" Runat="Server" />