0
我正在開發Windows Phone 8.1應用程序(WinRT),我想添加對SQLite的支持。我已將用於Windows Phone擴展的SQLite添加到項目中,並添加了SQLite-WinRT包裝器。我還將構建配置更改爲x86,以便它可以在模擬器中運行。 我的問題是:當我嘗試打開連接到數據庫文件(無論是創建或只是打開),我得到一個TypeLoadException。 我的代碼來打開連接是這樣的:使用Sqlite-WinRT時獲取TypeLoadException
using (var db = new SQLiteWinRT.Database(ApplicationData.Current.TemporaryFolder, "Database.db"))
{
await db.OpenAsync(SqliteOpenMode.OpenOrCreateReadWrite);
await db.ExecuteStatementAsync(@"create table if not exists MyTable (ID integer not null primary key autoincrement, Name varchar(150) not null);");
await db.ExecuteStatementAsync(@"insert into MyTable (Name) values ('Rafael');");
}
在第一線執行我得到這個錯誤:
這裏是我的項目引用的列表:
任何幫助表示讚賞。謝謝你們。
可能相關:[VS更新結果在System.TypeLoadException](http://stackoverflow.com/questions/26965647/vs-update-result-in-system-typeloadexception) –
這很有趣,我有VS2013更新4太。但重新安裝Windows和VS並不可行。同樣等待更新5也是不可行的,因爲如果沒有數據庫代碼,項目就無法前進。另外使用其他包裝如SQLite-Net對我來說不是好事,因爲它是一個ORM,我必須創建映射到表的表,這不是我擁有的數據庫關係的良好解決方案。 – Rafael