Forum Xamarin Xamarin.Forms

How to use the SQLite in windows phone 8 project?

PriyaSingh.6224PriyaSingh.6224 INMember ✭✭
edited April 2016 in Xamarin.Forms

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 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.

Best Answer


Sign In or Register to comment.