heyman
heyman

Reputation: 385

about vb2010 connect .mdb file

i make the vb homework
first, connect the mdb file, then login.
In the mdb file, there have login account and password.
when i run the program, it have some problem:
"dataAdapter.Fill(dt)" highlighted, The 'Microsoft.Jet.OLEDB.4.0xxxxxxx.mdb' provider is not registered on the local machine.

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

Upvotes: 0

Views: 1260

Answers (1)

Joel Coehoorn
Joel Coehoorn

Reputation: 415901

You're missing a semi-colon (;) in your connection string.

Upvotes: 1

Related Questions