#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Location
    USA
    Posts
    313
    Rep Power
    19

    ADO.NET and Access2k with a password


    In VB6 I used a password in Access 2000 and it worked great
    PHP Code:
        AccessConnect "Driver={Microsoft Access Driver (*.mdb)};" _
                        
    "Dbq=mydata.mdb;" _
                        
    "DefaultDir=" App.Path "\data\;" _
                        
    "Uid=;Pwd=george;"

        
    con.ConnectionString AccessConnect 
    Now in .NET and ADO.NET I used the following below and get an error. If I leave the password out and unset the password on the database it works all day and night. What am I missing?
    PHP Code:
    connectionString "Provider=Microsoft.Jet.OLEDB.4.0;Password=george;User ID=Admin;Data Source=" Apath "\mydata.mdb;"
    cnCode = New OleDb.OleDbConnection(connectionString
    Error
    FormName: frmMain
    Error Message: Cannot start your application. The workgroup information file is missing or opened exclusively by another user.
    Error Type: System.Data.OleDb.OleDbException
    Error Source: Microsoft JET Database Engine
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Location
    USA
    Posts
    313
    Rep Power
    19
    This works I had a guy from another forum post this and it did the trick. Thought others who are interested in using Access databases with passwords may find this handy.


    PHP Code:
    Dim oOleDbConnection As OleDb.OleDbConnection
    Dim strPassword 
    As String "password"
    Dim strDataBasePath as string "c:\project\database.mdb"

    Dim sConnString As String _
    "Provider=Microsoft.Jet.OLEDB.4.0;" _
    "Data Source=" strDataBasePath ";" _
    "Jet OLEDB:Database Password=" strPassword ";"

    oOleDbConnection = New OleDb.OleDbConnection(sConnString)
    oOleDbConnection.Open() 

IMN logo majestic logo threadwatch logo seochat tools logo