Posts

Showing posts from 2014

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"  providerNam…

ASP.net insert datatable into the database using dataadapter

ASP.net insert datatable into the database using dataadapter : To do this your datatable schema to be inserted should match with table schema of database. It will work on all database connection string:

Assuming said above your datatable is dtc then call insertTableinDB(dtc, "teamMaster")




PublicSharedFunction insertTableinDB(ByVal dt AsDataTable, ByVal mytablename AsString) AsString

'Create Connection String Dim myquery = "select * from " & mytablename & " limit 1" Using connection AsNewSQLiteConnection(System.Configuration.ConfigurationManager.ConnectionStrings("vindb").ConnectionString)
Try 'connection.Close()                 connection.Open() '' sqlComm = New SQLiteCommand("select * from gamemaster", connection) Dim da AsNewSQLiteDataAdapter(myquery, connection) Dim dcmd AsSQLiteCommandBuilder = NewSQLiteCommandBuilder(da)                 da.MissingSchemaAction = MissingSchemaAction.AddWithKey                 da.Update(…

Portable database : Sqlite with ASP.net

Problem: Unable to load sqlite.dll
Solution: Add from Nuget package both for x64 and x86

problem: Unable to open database (sqlite) in asp.net
solution : In IIS7 it simply fails with the Unable to open the database file error, ihmo because it tries to write to the Temporary ASP.NET Files folder.. use |DataDirectory| in path like this




Most of applications we develop on .NET in a professional way use to imply the existence of a database, usually SQL Server, Oracle, DB2 or MySQL. Nevertheless, sometimes, even we need database support, it's not necessary to mantain a database manager, because its portability, licensing, data volume and complexity...

In Android, each application uses a single local SQLite database. Why not applying the same philosophy to a .NET application? Well, it's possible to encapsulate the database in a .db file inside a local directory on the same way Android applications do. Let's see now how to install SQLite for .NET and programming a little applicati…

Google+ Followers