Public Sub page_load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load Dim DB As String = ("Provider=SQLOLEDB.1;data source=ADMINA-CC156333;Initial Catalog=test;Persist Security Info=True;User=sa;Password=123")
Dim Conn As New OleDbConnection(DB)
Dim Sqlstr As String = "select * from board where ArticleNo=30 "
Dim Cmd As New OleDbCommand(Sqlstr, Conn)
Dim reader As OleDbDataReader
Try
Conn.Open()
reader = Cmd.ExecuteReader()
Do While reader.Read()
Dim ListBox1 As New ListBox()
ListBox1.Text = reader("Subject")
Response.Write(reader("Subject"))
Loop
Catch ex As Exception Finally
If (Not Conn Is Nothing) Then
Conn.Close()
End If
End Try
End Sub
Dim Conn As New OleDbConnection(DB)
Dim Sqlstr As String = "select * from board where ArticleNo=30 "
Dim Cmd As New OleDbCommand(Sqlstr, Conn)
Dim reader As OleDbDataReader
Try
Conn.Open()
reader = Cmd.ExecuteReader()
Do While reader.Read()
Dim ListBox1 As New ListBox()
ListBox1.Text = reader("Subject")
Response.Write(reader("Subject"))
Loop
Catch ex As Exception Finally
If (Not Conn Is Nothing) Then
Conn.Close()
End If
End Try
End Sub
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码)
http://feiyun0112.cnblogs.com/