• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 28. Advanced Security Techniques > Encrypting a Database Using Code

Encrypting a Database Using Code

Chapter 27 showed how you can encrypt a database by using the user interface. If a database is not encrypted, it is not really secure because a savvy user can use a disk editor to view the data in the file. If you have distributed your application with the runtime version of Access, and you want to give your user the capability to encrypt the database, you must write ADO code to accomplish the encryption process. The code looks like this:

Sub Encrypt(strDBNotEncrypted As String, strDBEncrypted As String)
    Dim je As New JRO.JetEngine


    je.CompactDatabase SourceConnection:="Data Source=" _
     & strDBNotEncrypted & ";", _
        DestConnection:="Data Source=" & strDBEncrypted & _
        "; Jet OLEDB:Encrypt Database=True"
End Sub


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint