in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

Getting SQLite to work with VS 2010

Last post 02-05-2012 7:21 PM by lake393. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 02-05-2012 7:21 PM

    Getting SQLite to work with VS 2010

    Greetings, I was having some trouble getting it to work, and I finally found out how to do it, so I thought I would share.

    First of all, I don't know if this is the only way it will work. There might be other combinations too that will work.

    I used the "Managed Only" DLL, which for some reason is not available when you download the EXE from sourceforge. These are the options you get when you install the exe from sourceforge:

    To get the managed only DLL, you have to go get the "binaries zip" which is on sourceforge, but you can't just click the "looking for latest version?" link. have to keep clicking...

    In that zip, you get the "Managed Only" DLL which is what I used.

    Obviously extract that DLL (to anywhere, really) and Add it as a reference in your project (Build menu > Add Reference > Browse).

    I think the following is the important part:

    Right-click on your project in the Solution Explorer and go to properties. Go to the Compile tab. Click on Advanced Compile Options. At the bottom there is a dropdown box labeled "Target framework (all configurations)". Select ".NET Framework 2.0". Click OK. It will tell you you have to close and re-open the project.

    When you have it back open, there will be a number of errors. Click the "Show all files" icon in the Solution Explorer. Click the arrow next to References to expand the references. Right-click and remove all the ones with a little exclamation point:

    There will still be errors, so go to your project properties once again and go to the References tab. Look down and you will see a listbox with a bunch of checkboxes. Uncheck the boxes for System.Linq and System.Xml.Linq

    Now it should work properly. If you want to test, I created a very small / very basic SQLite program. It creates all the controls at runtime, so there is no need to do any designer work. Literally all you have to do is:

    • Create a new Windows Forms Application and make it compatable with SQLite by following the steps I outlined above
    • Go to the "code-behind" area for Form 1
    • Delete whatever default code might be there
    • Paste in this code
    • Hit the debug button (F5) to run

    Hopefully it will work out for you! Good luck.

Page 1 of 1 (1 items)
Powered by Community Server (Commercial Edition), by Telligent Systems