2016-06-09 39 views
0

我在Visual Studio中项目2015年安装了“SQLite的通用应用平台”的提法,后来我安装了NuGet包“sqlite.net-PCL-silverlight的”SQLiteConnection,C#

我想下面的行:

string dbPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "Storage.sqlite"); 
SQLiteConnection DB = new SQLiteConnection(dbPath); 

它不工作,但我发现,这行是有效的:

SQLiteConnection DB = new SQLiteConnection(sqlitePlatform, dbPath); 

我的问题是,我不知道这应该是sqlitePlatform的价值......请HEL页。

+0

'var connection = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(),path)'应该这样做...... –

+0

请参阅这里了解更多信息:http://www.shenchauhan.com/ blog/2015/11/25/sqlite-and-uwp –

+0

非常感谢你,它完美的工作; SQLiteConnection(新的SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(),路径) – Xavier

回答

0

对于UWP,与WinRT应该一样工作的sqlitePlatform。来吧,试试这个:

var connection = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path);

这应该为你工作。