Using SQLite in Your Windows Store Application

SQLite

SQLite image

SQLite is a great SQL database engine. Actually it is the most widely deployed SQL database engine in the world!

This useful database engine is available as an extension to Visual Studio.

How to install SQLite

install SQLite


Go to the “tools” menu and choose “Extensions and Updates”.

Choose the “Online” section, search for “SQLite” then download and install “SQLite for Windows Runtime”.

SQLite

download

close

Add the following reference to your project:

SQLite for Windows Runtime.

Microsoft Visual C++ Runtime Package.

Microsoft Visual

Now we see Yellow marks, so what's the solution?

You need to choose and build a specific architecture (x86, x64 or ARM) as in the following:

choose

architecture

Finally, the last step.

You need to install the Nuget sqlite.net (to call the SQLite APIs).

Nuget

This will add the 2 files to your solution SQLite.cs and SQLiteAsync.cs.

solution

Now, you're ready to use SQLite in your application!

Let's create a connection to the database.

create a connection

Create table

Create table

code

Finally create a ListView in MainPage.xaml and name it people as in the following:

  1. <ListView x:Name=”people” HorizontalAlignment=”Left” Height=”425″ Margin=”185,211,0,0″ VerticalAlignment=”Top” Width=”394″ Header=”people”/>