Db_sec_e_auth_failed[resolved]
i am trying to open a access database from an open file dialog box, and get its information. However, i am recieving the following error:
DB_SEC_E_AUTH_FAILED
i know that it has to do with my connection string. i have a textbox on my form that allows the user to type in the login and password if there is one.
VB Code:
Private Sub btnBrowseDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowseDB.Click
Dim loginvar = Me.txtLogin.Text
Dim passvar = Me.txtPassword.Text
Dim dt As DataTable
Dim filepath As String = " Data Source=" & opnExport.FileName.ToString
Dim login As String = "; User Id=" & loginvar
Dim pass As String = "; Password=" & passvar
Dim provider As String = "Provider=Microsoft.Jet.OLEDB.4.0; "
Dim connectionstring As String = provider & filepath & login & pass
With opnExport
.Filter = "Access Database (*.mdb)|*.mdb"
.FilterIndex = 1
.InitialDirectory = Application.StartupPath
.Title = "Open Access Database"
End With
If opnExport.ShowDialog() = DialogResult.OK Then
Dim dbConnect As New OleDb.OleDbConnection(connectionstring)
dbConnect.Open()
dt = dbConnect.GetOleDbSchemaTable(OleDb.OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "Table"})
MsgBox(dt.ToString)
End If
Me.txtDBPath.Text = opnExport.FileName.ToString
End Sub