UWP create database with SQLite

uwp sqlite entity framework
microsoft.data.sqlite example
sqlite for universal windows platform visual studio 2017
how to use sqlite in visual studio 2017
uwp sql server
unity uwp sqlite
db browser for sqlite
sqlite c#

I'm trying to create a database and its tables using SQLite in my UWP app. My code doesn't give me any error, but I can't find my database file.

SqliteEngine.UseWinSqlite3(); //Configuring library to use SDK version of SQLite
        using (SqliteConnection db = new SqliteConnection("Filename=sqliteSample.db"))
            // Resume Table
            String resumeTable = "CREATE TABLE IF NOT EXISTS Resume (resumeId INTEGER PRIMARY KEY AUTOINCREMENT, educationInfoId INTEGER NULL, personalInfoId INTEGER NULL, userId INTEGER, certInfoId INTEGER NULL, workInfoId INTEGER NULL)";
            SqliteCommand createResumeTable = new SqliteCommand(resumeTable, db);

            // PersonalInfo Table
            String personalInfoTable = "CREATE TABLE IF NOT EXISTS PersonalInfo (personalInfoId INTEGER PRIMARY KEY AUTOINCREMENT, userId INTEGER, city VARCHAR(100) NULL, email VARCHAR(50) NULL, name VARCHAR(100) NULL, state VARCHAR(10) NULL)";
            SqliteCommand createPersonalInfoTable = new SqliteCommand(personalInfoTable, db);
            catch (SqliteException e)

Is something wrong in the code? Where should the database file be?


You can use the SqlitePCL in nuget. http://sqlite.org/download.html

The download page have UAP softward that you should download it.

The download file is VSIX that you should install it.

Open Tools -> Extensions and Updates… -> Installed -> SDKs can see

Restart visual studio and right click your project References –> Add Reference and add sqlite

Open nuget search SQLitePCL.

There are some sql string

    private static String DB_NAME = "SQLiteSample.db";
    private static String TABLE_NAME = "SampleTable";
    private static String SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (Key TEXT,Value TEXT);";
    private static String SQL_QUERY_VALUE = "SELECT Value FROM " + TABLE_NAME + " WHERE Key = (?);";
    private static String SQL_INSERT = "INSERT INTO " + TABLE_NAME + " VALUES(?,?);";

    private static String SQL_UPDATE = "UPDATE " + TABLE_NAME + " SET Value = ? WHERE Key = ?";
    private static String SQL_DELETE = "DELETE FROM " + TABLE_NAME + " WHERE Key = ?"

Creat table

_connection = new SQLiteConnection(DB_NAME);
using (var statement = _connection.Prepare(SQL_CREATE_TABLE))


using (var statement = _connection.Prepare(SQL_INSERT))
    statement.Bind(1, key);
    statement.Bind(2, value);


using (var statement = _connection.Prepare(SQL_DELETE))
    statement.Bind(1, key);


using(var statement = _connection.Prepare(SQL_UPDATE))
    statement.Bind(1, value);
    statement.Bind(2, key);

See http://www.cnblogs.com/ms-uap/p/4798269.html

Using SQLite databases in UWP apps, Using SQLite databases in UWP apps to guarantee that the SQLite .db file and table are created the first time the application is launched. I'm trying to create a database and its tables using SQLite in my UWP app. UWP create database with SQLite. Browse other questions tagged c# sqlite uwp or ask

Looks like the code is correct. I just verified.

Unless you have done something custom, the default location should be:

C:\Users\"Your User Name"\AppData\Local\Packages\"Your App Package"\LocalState\sqliteSample.db

UWP: Create Database with SQLite in Universal App complete , UWP: Create Database with SQLite in Universal App complete sample. CodeDocu_com Duration: 26:44 Posted: May 20, 2016 The Microsoft.Data.Sqlite package relies on at least the 5.2.2 version of .NET Core for UWP, so we’ll begin by upgrading this: Right click on References ‣ Manage NuGet Packages Under the Installed tab, look for the Microsoft.NETCore.UniversalWindowsPlatform package and check the version number on the right-hand side.

  1. Download SQLite for Universal App Platform Extension -> add ref.
  2. Install nuget pack - SQLite.Net-PCL.


private static string dbPath = string.Empty;
    private static string DBPath(string fileName)
        if (string.IsNullOrEmpty(dbPath))
            dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, fileName);
        return dbPath;
    /// <summary>
    /// Get fileName From LocalFolder. Please Create first a dataBase.
    /// </summary>
    /// <param name="fileName"></param>
    /// <returns></returns>
    public static SQLiteConnection DbConnection(string fileName)
        return new SQLiteConnection(new SQLitePlatformWinRT(), DBPath(fileName));

UWP create database with SQLite, You can use the SqlitePCL in nuget. http://sqlite.org/download.html. The download page have UAP softward that you should download it. Start the [DB Browser for SQLite] application and press the [New Database] button. In the [Save File] dialog, select a location for the database and give it a name (I called it uwp.db). In the [Edit table definition] window give a name to the Table (I called it Data) and add two fields: [Name] and [Description].

Windows 10 Development - SQLite Database, To use SQLite in your Universal Windows Platform (UWP) applications, you need to follow the steps given below. Create a new Universal Windows blank app  SQLite is shipping with the Windows 10 Anniversary edition (yes, it is now included with Windows) and Microsoft recommendeds it for all Universal Windows Platform (UWP) application local data storage needs (see Data Access in Universal Windows Platform (UWP) Apps - Building Apps for Windows).

How to Load Data from an SQLite Database into a UWP ListView , Next, we are going to create an SQLite database and fill it with some data. For that, we will use the [DB Browser for SQLite] application, which  Sqlite is a free database program that can be used for “light” database applications. It supports both transactions and SQL calls and is relatively easy to use. Integration of Sqlite into a UWP application is quick and easy; the steps used to include Sqlite in your C# UWP application are listed below.

Local SQLite on UWP, Create a new project; Upgrade Microsoft.NETCore.UniversalWindowsPlatform; Install Entity Framework; Create your model; Create your database; Use your  Select Extensions from the left pane under Universal Windows, check SQLite for Universal App Platform in the middle pane, and click Ok. Now you are ready to go and use SQLite in your UWP applications. You can create a database by using the following code. string path = Path.Combine(Windows.Storage.ApplicationData.

  • The database is in the directory that you have specified in the connection string.