Access password

danasegarane

Active member
Joined
Jun 14, 2006
Messages
41
Programming Experience
Beginner
Hi all,
I am using this code to create a Access Database.

VB.NET:
'Mark Reference to 
'Microsoft ADO Ext.2.8 for DDL and Security
'From the COM tab
Public Shared Function CreateDatabase(ByVal DatabasePath As String, Optional ByVal DatabaseType As JetEngineTypes = JetEngineTypes.Jet4X) As Boolean

        Dim adocat As ADOX.Catalog
        Dim con As String

        adocat = New ADOX.Catalog

        con = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=" & DatabaseType & ";Data Source = " & DatabasePath

        Try
            Call adocat.Create(con)
            m_objadoCatalog = adocat
            Return True
        Catch
            Return False
        Finally
            adocat = Nothing
        End Try
    End Function

Now I want to add a Password to the database.How can I do this

Thanks in Advance
Dana
 
No Problem.
I found the answer.Here is the Full code

VB.NET:
'Mark Reference to 
'Microsoft ADO Ext.2.8 for DDL and Security
'From the COM tab
Public Shared Function CreateDatabase(ByVal DatabasePath As String, Optional ByVal DatabaseType As JetEngineTypes = JetEngineTypes.Jet4X) As Boolean

        Dim adocat As ADOX.Catalog
        Dim con As String

        adocat = New ADOX.Catalog

        con = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=" & DatabaseType & ";Data Source = " & DatabasePath & [COLOR="Red"]";Jet OLEDB:Database Password=test"[/COLOR]

        Try
            Call adocat.Create(con)
            m_objadoCatalog = adocat
            Return True
        Catch
            Return False
        Finally
            adocat = Nothing
        End Try
    End Function
 
and if you need encryption :-

VB.NET:
Jet OLEDB:Encrypt Database=True;
 
Back
Top