Opening a password encrypted access database using DAO VB.NET

Posted by prasoon99 on Stack Overflow See other posts from Stack Overflow or by prasoon99
Published on 2010-04-20T16:14:01Z Indexed on 2010/04/20 16:33 UTC
Read the original article Hit count: 394

Filed under:
|
|
|
|

I create a database like this:

Sub Main()

        Dim wrkDefault As Workspace
        Dim dbE As DBEngine
        Dim dbs As Database

        'Get default Workspace.
        dbE = New DBEngine
        wrkDefault = dbE.Workspaces(0)

        'Set the database filename
        Dim DBFilename As String
        DBFilename = "c:\mydb.mdb"

        'Make sure there isn't already a file with the same name of
        'the new database file.
        If Dir(DBFilename) <> "" Then
            MsgBox("File already exists!")
            Exit Sub
        End If

        'Create a new encrypted database with the specified
        'collating order.
        'lock database with the password 'hello'
        dbs = wrkDefault.CreateDatabase(DBFilename, _
              LanguageConstants.dbLangGeneral & ";pwd=hello;", DatabaseTypeEnum.dbEncrypt)

        dbs.Close()

    End Sub

How do I open this database again in VB.NET using DAO?

© Stack Overflow or respective owner

Related posts about password

Related posts about database