SQLite on C#

 

In this part should be the explanation of SQLite and what it is… but I don’t feel like explaining this today, so I’m skipping this step.

 

And after the explanation of what is SQLite, now we are using it in an example with C# on UWP.

Before starting we need to download the SQLite reference from the official page, https://www.sqlite.org/download.html.

Once downloaded and installed, we need the references on the app

 

 

After this we need to make an internal reference on Nuget (don’t ask, I just mash up some examples and it worked fine) . Make a search of “SQLite-PCL” and install this package.

 

 

After this, you need to add the library on the project you are working on.

using SQLitePCL;

Once this is done, it should be easy to implement the creation of a table

public
void createTable()

{


using (var connection = new
SQLiteConnection(“Storage.db”))

{


using (var statement = connection.Prepare(@”CREATE TABLE IF NOT EXISTS Student (

ID INT(10),

NAME NVARCHAR(50),

CGPA NVARCHAR(10));”))

{

statement.Step();

}

}

}

And this is the first example of SQLite on UWP.