如何将DataGridView绑定到SQLite数据库? [英] How to bind a DataGridView to a SQLite Database?

查看:656
本文介绍了如何将DataGridView绑定到SQLite数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向使用SQLite的datagridview添加数据连接。我已经添加了对SQLite的引用(下载了所需文件),但是当我通过向导添加数据源时,SQLite不包含在选项中-
参见下面的屏幕截图:





我一直在寻找该问题的答案,但未能成功找到任何。



这是我的项目文件夹中数据库的屏幕截图:




  1. 转到工具>库软件包管理器>管理NuGet软件包以获取解决方案...

  2. 选择在线部分,并在上方的文本框中输入SQLite,右上角。按ENTER键等待搜索。

  3. 选择第一个包:System.Data.SQLite(x86 / x64)。

  4. 一次该软件包已下载,请选择要在其中安装提供程序的项目,然后按OK。

如果数据源仍然存在在执行上述步骤后仍然无法使用,则SQLite版本可能存在问题-请参见 cmc留下的注释链接的线程,它表示1.0.93版有效,而1.0.94版无效。


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:

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:

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

Any help would be appreciated.

Thanks!

解决方案

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.

这篇关于如何将DataGridView绑定到SQLite数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆