14

I'm trying to add a data connection to a datagridview that uses SQLite. I've added the reference to SQLite (downloaded the required files) but when I go through the wizard to add a data source, SQLite is not included in the choices - see screenshot below:

Change Data Source

I've looked around for answers to this question but have not been successful in finding any.

Here is a screenshot of the database inside my project folder:

project folder

Is there any way to bind the datagridview to a sqlite data source?

Any help would be appreciated.

Thanks!

Steve Chambers
  • 37,270
  • 24
  • 156
  • 208
user2101411
  • 1,204
  • 2
  • 14
  • 33

2 Answers2

8

The steps below are copied from http://geekswithblogs.net/danielggarcia/archive/2013/12/22/portable-databases-ii-using-sqlite-with-entity-framework.aspx:

  1. Go to Tools > Library Package Manager > Manage NuGet Packages for solution...
  2. Choose the Online section and write SQLite inside the textbox located on the upper-right corner. Push ENTER and wait for the search to be performed.
  3. Choose the first package: System.Data.SQLite (x86/x64).
  4. Once the package has been downloaded, select the project in which to install the provider and press OK.

If the data source still isn't available after following the above steps don't work, it may be a problem with the SQLite version - see the comment left by cmc and the linked thread, which says version 1.0.93 works but version 1.0.94 doesn't.

Steve Chambers
  • 37,270
  • 24
  • 156
  • 208
  • unfortunately I can't seem to get it to work. I'm using version 1.0.105.2 (the latest under nuget) – user2101411 Oct 20 '17 at 17:11
  • no, I don't see it listed under NuGET, just 1.0.105.2 – user2101411 Oct 20 '17 at 21:53
  • The older version needs to be downloaded manually - see the [bottom post in the thread](http://sqlite.1065341.n5.nabble.com/sqlite-data-source-not-available-td78521.html#d1420821460917-378) and its links to [32 bit](http://system.data.sqlite.org/downloads/1.0.93.0/sqlite-netFx40-setup-bundle-x86-2010-1.0.93.0.exe) and [64 bit](http://system.data.sqlite.org/downloads/1.0.93.0/sqlite-netFx40-setup-bundle-x64-2010-1.0.93.0.exe) versions of 1.0.93. – Steve Chambers Oct 21 '17 at 12:20
  • downloaded that and installed and added the reference but these steps (http://geekswithblogs.net/danielggarcia/archive/2013/12/22/portable-databases-ii-using-sqlite-with-entity-framework.aspx) are not working, as I don't see the sqlite option for the entity model – user2101411 Oct 21 '17 at 12:49
  • Well it seems like the whole thing with SQLite and Visual Studio is a bit of a mess - the current answers to [this question](https://stackoverflow.com/questions/25089346) don't exactly inspire confidence but might possibly get you there if you're prepared to be fix to particular versions and put in some effort. In particular, [this answer](https://stackoverflow.com/questions/25089346#32228932) is the nearest to what's described above. – Steve Chambers Oct 23 '17 at 21:42
  • really frustrating, oh well – user2101411 Oct 23 '17 at 22:06
  • yeah i was following the instructions in that video but i have no idea what is going on. I have Visual Studio 2017 Community Edition so maybe that's it because everything that was done on the video I did and it still will not work. – user2101411 Oct 23 '17 at 22:36
  • Another very similar question here: https://stackoverflow.com/questions/24285676/how-to-get-system-data-sqlite-database-file-option-in-datasource – Steve Chambers Oct 26 '17 at 08:10
2
  1. Go to Tools > Library Package Manager > Manage NuGet Packages for solution...
  2. Choose the Browse section and search for Microsoft.SqlServer.Compact
  3. Install it
  4. Click on View > Other Windows > SQLite/SQL Server Compact Toolbox will be appeared there.
  5. Click on SQLite/SQL Server Compact Toolbox and you can easily manage connection. Screenshots are attached

    enter image description here

    enter image description here.

mzh
  • 515
  • 8
  • 21