-
Nov 30th, 2004, 09:26 PM
#1
Thread Starter
Hyperactive Member
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
Last edited by Grunt; Nov 30th, 2004 at 09:50 PM.
-
Nov 30th, 2004, 09:49 PM
#2
Thread Starter
Hyperactive Member
oops, im stupid.
i needed to put all the dims in the if block.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|