1
votes

I am trying to use SQLite in C# but I seem to get an error I literally dont understand

What I have done so far : downloaded the package provided on http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki

I downloaded the one with the mixed-mode for windows 64, 4.0 .NET framework. I got it installed in C:\Program files under system.data.SQLite. I made a new project in visual studio, added a reference to System.Data.SQLite.dll and wrote Using system.data.sqlite

After that I created a new instance of SQLiteconnection like this:

     SQLiteConnection conn = new SQLiteConnection("data source = C:\\Users\\chr\\Desktop\\test.db; version=3");

I get the following error:

An unhandled exception of type 'System.BadImageFormatException' occurred in WindowsFormsApplication4.exe

Additional information: Could not load file or assembly 'System.Data.SQLite, Version=1.0.98.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. An attempt was made to load a program with an incorrect format.

1
practice using string $ prefix like @"data source = C:\Users\chr\Desktop... - Ramgy Borja

1 Answers

0
votes

usually that error rise up when you compile in 32bit and refers to some 64bit assembly or viceversa

be sure to compile your .exe using the right destination platform (Project property -> Build -> Platform Target )

can't you use the Nuget package?