Reputation: 465
I've created a Xamarin.Forms project having Android, iOS and Windows Phone. I'm trying to use the Sqlite Database in Xamarin Windows Phone 8.1 project and I've installed the sqlite.net pcl and core and async libraries with platform library. When I try to run the project it shows an error winrt.dll sqlite3 could not be found. There are actually two reference libraries for sqlite.platforms.windowsPhone8 so I've added it as x86 but still having problem. Here is my code for windows phone 8.1
namespace SwachhParyatanApp.WinPhone
{
class DBPath_WinPhone : IDBPath
{
public SQLiteAsyncConnection GetDBPath()
{
var path = Path.Combine(ApplicationData.Current.LocalFolder.Path, "localData.db");
var platform = new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT();
var param = new SQLiteConnectionString(path, false);
var connection = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(platform, param));
return connection;
}
}
}
Whenever I try to call using the dependency service its shows error on the line var platform = new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT();
By default the WinRT library was added to the project but it was also having problem so I added the windowsphone8 library.
Upvotes: 0
Views: 622
Reputation: 13092
Windows phone does not included the SQLite, like iOS and Android.
You need to download the SQLite extension for VS, and reference it in your project.
I would recommend using the SQLite-net PCL, it's an ORM for SQLite and provides nice async/synchronous APIs on top of regular SQLite APIs
Upvotes: 2
Reputation: 465
I've found the answer, we need to add sqlite3.dll from sqlite.org for windows phone 8.1 WinRT site manually.
Upvotes: -1