0
我先做vb作業
先連接mdb文件,然後登錄。
在mdb文件中,有登錄帳戶和密碼。
當我運行該程序時,它有一些問題:
「dataAdapter.Fill(dt)」突出顯示,「Microsoft.Jet.OLEDB.4.0xxxxxxx.mdb」提供程序未在本地計算機上註冊。關於vb2010連接.mdb文件
Private Sub loginButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles loginButton.Click
Dim connStr As String = "Provider=Microsoft.Jet.OLEDB.4.0" & "Data Source=xxxxxxx.mdb"
Dim sqlStr As String = "Select * from account"
Dim dataAdapter As New OleDb.OleDbDataAdapter(sqlStr, connStr)
dataAdapter.Fill(dt)
dataAdapter.Dispose()
For i As Integer = 0 To (dt.Rows.Count - 1)
If TextBox1.Text = CStr(dt.Rows(i)("accountid")) And TextBox2.Text = CStr(dt.Rows(i)("password")) Then
login = True
End If
Next
If login = True Then
MsgBox("logined")
Else
MsgBox("Incorrect username or password. Please try again.")
TextBox1.Clear()
TextBox2.Clear()
End If
解決方法:提供者錯誤 應該是Provider = Microsoft.ACE.OLEDB.12.0; – heyman 2012-04-05 12:57:09