C# Windows Forms + Windows 7 + System.Data.SQLite v. = crash?


Hey guys, I'm currently experiencing a very strange crash in Windows 7 in a C# Windows Forms application developed in Visual Studio 2008.

The app - which works great in both XP and Vista - never really opens; instead, a "this application has caused an error and has stopped working". I made a dummy application with the following source-code:

using System; using System.Windows.Forms; using System.Data.Common; using System.Data.SQLite; namespace TesteWin7 { public partial class Form1 : Form { public Form1() { InitializeComponent(); SQLiteConnection.CreateFile("c:\\mydatabasefile.db3"); } } }

and still it crashes, so I'm guessing this issue must be on my DLL. Putting the source-code inside a try-catch block is also useless, as no message is outputted.

Any thoughts on this? I'm using <a href="http://sqlite.phxsoftware.com/" rel="nofollow">System.Data.SQLite</a> version Cheers!


I don’t think it has anything to do with Windows 7. I suspect it’s because you used a 32-bit Windows XP and Windows Vista, but a 64-bit Windows 7. Is that the case?

The solution to that is to change the platform for your Visual Studio Project from “Any CPU” to “x86”. Otherwise the sqlite DLL will not load into your 64-bit process because it is 32-bit. Even if my theory is wrong and you used a 32-bit Windows 7, you should still do that because it will still crash on 64-bit systems if you don’t.

Don’t worry about the performance of running your entire process as 32-bit on a 64-bit machine. It really doesn’t matter. Starting with Visual Studio 2010, “x86” is even the default.


Have you checked the following:

<ul><li>The Windows Event Log (Start > "Event Viewer") to see if anything has been logged that may be of use?</li> <li>That the user you're running the application as has permission to write to the root of drive C:\?</li> <li>That it's specifically SQLLite causing a problem? Try using the code below to verify that it's specifically SQLLite:</li> </ul>

Code to create a file manually, o/s of SQLLite:

var file = System.IO.File.CreateText("C:\TextFile.txt"); file.WriteLine("Blah"); file.Close();


  • mono sqlite w/o mono on windows?
  • MS Access VBA SQL query debugging select case
  • How to create a db3 database with Sqlite-Net
  • Post image with text on facebook from android
  • Get news headlines from nu.nl in a text file
  • Loop in vba which will go through all sheets and get data [closed]
  • Why do I receive this error: The remote server returned an error: (417) Expectation Failed
  • GROUP_CONCAT change GROUP BY order
  • Java error : cannot find symbol even if the .class file are all in the same directory
  • How to filter out or stop getting data field within Opendaylight(Oxygen) BGP-LS data change event
  • apply padding to end of line html css
  • How can I load a .sql file when running a Maven/Hibernate project?
  • Transition State Diagram R
  • Trim Not Working with Array from MySQL fetched String
  • Increase max url length in asp.net core
  • Angular - TypeError: Converting circular structure to JSON
  • OnSharedPreferenceChangeListener not called #2
  • On submit the form don't display its POST data
  • Using iText to fill text field background
  • Always get thread error even if unit test passes in Android using Mockito
  • How to create file with help of P/Invoke to read boot sector and display .MBR?
  • C++(Serial Communicatio using the ) - How can i find out before hand, how many characters will be re
  • How does file creation work in Java
  • Query multiple tables SQLite Windows 10 UWP
  • System.Data.SQLite BadImageFormatException with NHibernate, works finewhen standalone
  • SQLite exception when creating a connection
  • rename javascript object in order to use a php array
  • How to load an image in ASP.NET from a database as a file in a web browser?
  • Form with a MainMenu shrinks every time the project is run
  • Inheriting code-behind class from PhoneApplicationPage's subclass
  • WPF8/C# - Binding Data To Grid
  • Focus Traversal Policy in TitledPane
  • libcurl compile errors
  • c# open webrowser in many tab
  • Why doesn't :active or :focus work on text links in webkit? (safari & chrome)
  • jQuery tmpl and DataLink beta
  • AT Commands to Send SMS not working in Windows 8.1
  • SQL merge duplicate rows and join values that are different
  • Proper way to use connect-multiparty with express.js?
  • How to set the response of a form post action to a iframe source?