Advertisement.

TransHimalaya.in

Everest Helicopter Tour for a day

Book exciting packages at www.transhimalaya.in

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"  providerName="System.Data.SqlClient" /]
  [/connectionStrings]

Comments

Most Viewed Post

solution for facebook static.ak.fbcdn.net waiting

Connect Sony XPLOD MEX-BT2500 Bluetooth CD Receiver with ur mobile

Crystal Report : Show data horizontally (Left to right) i.e. columns as rows

Google+ Followers