2016-06-09 37 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);

這應該爲你工作。