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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s