0
votes

I'm developing application by using Xamarin Forms. I need database so I install sqlite-net-pcl by Frank A.Krueger via NuGet package manager. I try to get connection in PCL project:

ISQLiteHelper sqlLiteHelper = DependencyService.Get<ISQLiteHelper>();
string pathToDatabaseFile = sqlLiteHelper.GetLocalDatabaseFilePath(databaseFilename);
this.database = new SQLiteConnection(pathToDatabaseFile);

But I got an exception.

"Unable to load DLL 'e_sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"

I followed by some answers and download and installed sqlite-wp81-winrt-3180000.vsix Than I added the following references into my WinPhone 8.1 project: Reference Manager -> Windows Phone 8.1 -> Extensions -> SQLite for Windows 8.1 But it did not help me. I got the same error.

I changed my target platform to x86. For Any CPU I get an error:

"Any CPU" is not supported by the referenced SDK "Microsoft.VCLibs, Version=12.0". Please consider changing the targeted processor architecture of your project (in Visual Studio this can be done through the Configuration Manager) to one of the architectures supported by the SDK: "x86, ARM". App1.WinPhone

Reference manager screenshot

NuGet screenshot

enter image description here

I got that error if I change my target platform to x64 like my PC has.

"X64" is not supported by the referenced SDK "Microsoft.VCLibs, Version=12.0". Please consider changing the targeted processor architecture of your project (in Visual Studio this can be done through the Configuration Manager) to one of the architectures supported by the SDK: "x86, ARM". App1.WinPhone

"X64" is not supported by the referenced SDK "SQLite.WP81, Version=3.18.0". Please consider changing the targeted processor architecture of your project (in Visual Studio this can be done through the Configuration Manager) to one of the architectures supported by the SDK: "x86, ARM". App1.WinPhone

1

1 Answers

0
votes

SOLUTION: You can use SQLite.Net-PCL by Oustein Krog, Frank Krueger, Tim Heuer instead of sqlite-net-pcl.

The creation of collection will look like this one:

this.database = new SQLiteConnection(databaseFilename);