SQLite is a light (lite) weight software library that can be used to perform database operations. It provides a small, fast, contained, reliable, SQL database engine that can be used on devices with low power like Mobile or PC with low RAM. Remember it’s not SQL.
Here are a few differences between SQL and SQLite,
- SQL is server based whereas SQLite is files based
- SQLite does not support all features of SQL like stored procedures.
- SQL is standard that specifies how data can be stored whereas SQLite is a set of libraries
Here are few major features that makes SQLite unique and very popular,
- Zero configuration -- that means there is no need to setup anything. Just install and use.
- Self contained, that means no external dependency
- Cross platform means it can be used on Linux, Mac, Andriod
- Serverless - that means no separate server is required. SQLite directly communicates with database file of application.
- SQLite supports dynamic types; i.e. in tables any value can be stored irrespective of column data type.
How to use SQLite (using Nuget)
SQLite comes as a Nuget package so it can be used very easily
- Create a Visual Studio Project
- In Nuget Manager Search/Select 'SQLite'
- Install it.
Done !! Very easy.
You are done ?? Now you could start coding as you used to do with SQL in C#.
While writing the code use reference of ‘System.Data.SQLite’ .
While making the connection string use path of dbFile so full connection string would be like
String conStrng = @"Data Source = " + dbFilePath + ";" + "Password=" + “ABCD”;
After that create connection using SQLiteConnectionObject and then you could do Insert/Update/Delete etc operations using various Api’s available like SQLiteDataReader, SQLiteCommand
Happy Learning with SQLite!!