0
我試圖讓使用此代碼從MS Access數據庫中的數據,但我不能,這是我的代碼這是正確的從數據庫asp.net中獲取數據
Dim query As String = "SELECT [data] FROM tabless WHERE user = '" & user.Text & "'"
Using connection As New OleDbConnection(connectionString)
Dim cmd As New OleDbCommand(query)
Dim adapter As OleDbDataAdapter = New OleDbDataAdapter(query, connection)
Dim com As New OleDbCommand(query, connection)
connection.Open()
'on the line below I get an error: connection property has not been initialized
Dim reader As OleDbDataReader = cmd.ExecuteReader()
While reader.Read()
Label1.Text = (reader(0).ToString())
End While
reader.Close()
End Using
數據庫
|data|
asl
試圖從數據庫中獲取數據並試圖在標籤中顯示它是可能的
錯誤是什麼?調試時會發生什麼? – JKerny
'Dim reader As OleDbDataReader = cmd.ExecuteReader()' 連接屬性尚未初始化 – Craftx398
該信息應該是您問題的一部分。請在此處進行修改,並意識到您需要在發佈的每個問題中都包含這類信息。我們不應該問你這個問題。 – mason