1

I was previously using System.Data.SQLite in a .NET library, and now want to port this library to an Universal Windows library.

I cannot make the System.Data.SQLite work (since I guess it is not portable), and found only LINQ style SQLite PCL libraries in NuGet ...

Is there a way that I can use good all fashion queries in an Universal Windows App in order to have the same or close syntax as in System.Data.SQLite?

Something like this :

SQLiteCommand dbCommand = new SQLiteCommand(dbConnection);
dbCommand.CommandText = dbQuery;

SQLiteDataReader reader = dbCommand.ExecuteReader();

1 Answer 1

1

You can use the SQLite.NET-PCL in Universal Windows Platform App (search sqlite.net-pcl in NuGet).

var path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "db.sqlite");

using (SQLite.Net.SQLiteConnection conn = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path)) 
{
    conn.CreateTable<User>();
}

The blog will introduce you the detail steps about how to use SQLite in UWP.

http://igrali.com/2015/05/01/using-sqlite-in-windows-10-universal-apps/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.