Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've broken the code down to the smallest possible statement:

Dim cn As System.Data.SQLite.SQLiteConnection

And I get the following error when calling the code from a WinForm applicaiton:

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

Yet calling the same piece of code from MS Unit Test I do not get the error, plus the full code set works as expected.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
560 views
Welcome To Ask or Share your Answers For Others

1 Answer

SQLite contains unmanaged code, you can't run it on a 64-bit operating system unless you deploy the 64-bit version. Quick fix: Project + Properties, Build tab, Platform Target = x86.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...