Ever since I am writing my programs, I have delt with databases. The one big thing to protect the user to inadvertently changing the database by opening it and changing something is one of the nightmares all software programmers face.
To tackle this, for Microsoft (R) Access database, we password protect the database. I will not go in details on how to password protect Access database (as this can be another blog in itself), I will show how to open such password protected Access databases through VB.net
Use following connection string to open the normal database
Public ConString As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = " & Application.StartupPath & "\MyDatabase.mdb"
Use following connection string to open a Password protected database
Public ConString As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = " & Application.StartupPath & "\MyDatabase.mdb;Jet OLEDB:Database Password = " & PassWD & " "
Where PassWD is a string constant stored somewhere in the program
I hope this will help someone doing database programming and forgotten how to open a password protected database through VB.net
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment