Click here to Skip to main content
15,891,849 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

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>(); 

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.
Posted

1 solution

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.
 
Share this answer
 
Comments
yamen-nassif 12-Mar-14 9:19am    
I am sorry i have already tried that
and it didn't work for me
i tried to change the target platform and it didn't work
Dave Kreskowiak 12-Mar-14 9:33am    
Well, that's what is going on. If you're got one library that is 32-bit and another library that is 64-bit, you can make that change and end up with the same problem.

Check to make sure every library you're using is the same architecture (32 or 64-bit), then compile your code to that architecture.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900