在我的通用應用程序Windows 8.1(存儲)和Windows Phone 8.1中,只有在應用商店中打開數據庫時纔有例外。這兩個代碼是共享的,並且對於正在工作的Windows Phone。Windows Store應用程序中的SQLite異常
class MemoDB
{
public static SQLiteConnection conn;
public MemoDB() {
conn = LoadDatabase();
}
static private SQLiteConnection LoadDatabase()
{
// Get a reference to the SQLite database
conn = new SQLiteConnection("ct_history.sqlite");
...
}
}
異常{「無法設置臨時目錄。」}出現在代碼的最後一行顯示,細節是這樣的:
SQLitePCL.SQLiteException was not handled by user code.
HResult=-2146233088
Message=Unable to set temporary directory.
Source=SQLitePCL
StackTrace:
at SQLitePCL.SQLiteConnection.SetTemporaryDirectory()
at SQLitePCL.SQLiteConnection..ctor(String fileName, Boolean setTemporaryDirectory)
at SQLitePCL.SQLiteConnection..ctor(String fileName)
at CTDICT.MemoDB.LoadDatabase()
at CTDICT.MemoDB..ctor()
at CTDICT.Dictionary..ctor()
at CTDICT.CTDICT_Windows_XamlTypeInfo.XamlTypeInfoProvider.Activate_8_Dictionary()
at CTDICT.CTDICT_Windows_XamlTypeInfo.XamlUserType.ActivateInstance()
InnerException: SQLitePCL.SQLiteException
HResult=-2146233088
Message=Unable to open the database file: :memory:
Source=SQLitePCL
StackTrace:
at SQLitePCL.SQLiteConnection..ctor(String fileName, Boolean setTemporaryDirectory)
at SQLitePCL.SQLiteConnection.SetTemporaryDirectory()
InnerException: System.DllNotFoundException
HResult=-2146233052
Message=DLL "sqlite3.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E) can not be loaded.
Source=SQLitePCL.Ext
TypeName=""
StackTrace:
at SQLitePCL.SQLite3Provider.NativeMethods.sqlite3_open(IntPtr filename, IntPtr& db)
at SQLitePCL.SQLite3Provider.Sqlite3Open(IntPtr filename, IntPtr& db)
at SQLitePCL.SQLiteConnection..ctor(String fileName, Boolean setTemporaryDirectory)
InnerException:
這在我看來,「DLL sqlite3.dll:指定的模塊無法找到「正在指出問題。我已經檢查了路徑「C:\ Program Files(x86)\ Microsoft SDKs \ Windows \ v8.1 \ ExtensionSDKs \ SQLite.WinRT81 \ 3.8.5 \」,並發現所有配置中的DLL(ARM,x64,x86) 。
適用於Windows運行時(Windows 8.1)(版本3.8.5.0)和SQLitePCL(v4.0.30319)的SQLite引用已正確設置。
不知道該怎麼辦?
幸運的是你。我正在面對類似的問題,在UWP應用程序,[無法加載dll sqlite3.dll指定的模塊無法找到inuwp](http://stackoverflow.com/questions/36521860/unable-to-load-dll-sqlite3-dll -the-指定模塊-可以-不待發現合UWP) – hal9k2