Posts

Showing posts from December, 2014

ASP.Net Set Password Protection for SQLite Database

SQLite.dll for .net has inbuilt feature to encrypt the database.
You can set password programatically so whenever someone try to use some GuI to open .db file then it will give error.

Public Shared Function encryptDB(ByVal pwd As String) As String
    'Create Connection String
        Using connection As New SQLiteConnection(System.Configuration.ConfigurationManager.ConnectionStrings("vindb").ConnectionString)
            Try
                connection.Open()
                connection.ChangePassword(pwd)
                connection.Close()
                Return "ok"
            Catch ex As Exception
                Return "Error:" & ex.Message
            End Try

        End Using
    End Function

To access database you have to provide password in connection string of web.config

[connectionStrings]
    [add name="vindb" connectionString="Data Source=|DataDirectory|projxdb.db;Version=3;New=False;Compress=True;password=jeannie"  providerNam…

Google+ Followers