windows8.1中的sqlite3数据库System.BadImageFormatException [英] sqlite3 database System.BadImageFormatException in windows8.1
问题描述
当我终于发现metro风格不支持这个数据库客户端时,我已经尝试了两天让SQL服务器2012以metro风格运行。然后我切换到sqlite3数据库。我已经为每个数据库创建了类。但是当我尝试使用此代码创建数据库时
I have been trying for two days to get the SQL server 2012 to run with metro style when I finally discovered that metro style doesn't support this database client. then I switched over to sqlite3 database. I have created the classes for each database.But when i try to create the DB with this code
private async void CreateDatabase()
{
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("people");
await conn.CreateTableAsync<users>();
await conn.CreateTableAsync<groups>();
}
发生以下错误
the following errors occur
An exception of type 'System.BadImageFormatException' occurred in EduHaptics.exe but was not handled in user code
其他信息:尝试加载格式不正确的程序。 (来自HRESULT的异常:0x8007000B)行
Additional information: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) in the line
SQLite3.SetDirectory(/*temp directory type*/2, Windows.Storage.ApplicationData.Current.TemporaryFolder.Path);
和行上的同样错误
and same error at line
await conn.CreateTableAsync<users>();
尝试在我获取之后手动插入路径,但是会出现同样的问题。我也导航到它确实存在的位置,但它是一个空文件夹。我有一个线索,因为String本身可能没有很好地读取路径,但我不知道该怎么办!!任何帮助请我在Visual Studio 2013 64位环境中编程,我获得了sqlite-winrt81-3080401版本。
tried to insert the path manually after i acquired it, but the same problems occur. I also navigated to that location it does exist but it is an empty folder. I have a clue that it might be not reading the path well because of the String itself but i don't know what to do!! any help please I am programming in visual studio 2013 64-bit environment and i acquired the sqlite-winrt81-3080401 version.
推荐答案
您通常在编码时遇到该错误作为一个体系结构(64位)运行,并且您尝试使用的一个或多个库仅为32位,如SQLite库,或者反过来。
仅将代码重新编译为32位,问题应该消失。
You usually get that error when you code is running as one architecture (64-bit) and one or more libraries you're trying to use are 32-bit only, like the SQLite library, or, the other way around.
Recompile your code as 32-bit only and the problem should go away.
这篇关于windows8.1中的sqlite3数据库System.BadImageFormatException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!