Visual Studio 2010(.NET 4.0)中使用SQLite.NET
Visual Studio 2010(.NET 4.0)中使用SQLite.NET
SQLite.NET可以使我们很方便的在.net环境下操作SQLite数据库,但是最新版本的SQLite(支持VS2010和.NET4.0)貌似还没有完成,我下载下来后发现缺少很多东西,特别是Linq。
目前已经为.net 4.0提供了安装程序和经过编译的dll文件,可以按照需要下载了,下载地址:http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki。
但是我还是想在VS2010和.NET4.0下做开发,没有别的好办法,还是继续使用之前的支持.NET 2.0的版本吧。需要按照以下步骤设置下:
1、安装SQLite.NET
在这里下载安装文件:http://sourceforge.net/projects/sqlite-dotnet2/
2、项目中添加引用
找到SQLite.NET安装目录,在bin目录下,添加两个引用:
System.Data.SQLite.dll
System.Data.SQLite.Linq.dll
注意引用属性,“复制本地”设置为“true”,以便于发布程序。
3、修改web.config或者app.config
在configuration配置节下添加:
<system.data> |
<DbProviderFactories> |
<remove invariant="System.Data.SQLite"/> |
<add name="SQLite Data Provider" invariant="System.Data.SQLite"description=".Net Framework Data Provider for SQLite"type="System.Data.SQLite.SQLiteFactory,System.Data.SQLite"/> |
</DbProviderFactories> |
</system.data> |
增加一个数据提供程序:SQLite Data Provider。
修改startup配置节为:
<startup useLegacyV2RuntimeActivationPolicy="true"> |
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/> |
</startup> |
使用useLegacyV2RuntimeActivationPolicy支持以前版本的.net运行时环境。
有的提供的解决方法还包含了requiredRuntime,msdn上说这个只支持1.0版本的公共语言运行时环境,所以没有必要添加。
这样配置以后就可以使用SQLite.NET了,但是如果想生成edmx文件还不行,可以先使用低版本生成,再将项目升级到.net4.0达到使用“ADO.NET实体数据模型”的目的。
相对路径设置:
data source=|DataDirectory|\DB"
来源:http://blog.bossma.cn/database/visual-studio-2010-and-dotnet-4-sqlite-net/来源:
Visual Studio 2010(.NET 4.0)中使用SQLite.NET的更多相关文章
- 【转】【UML】使用Visual Studio 2010 Team System中的架构师工具(设计与建模)
Lab 1: 应用程序建模 实验目标 这个实验的目的是展示如何在Visual Studio 2010旗舰版中进行应用程序建模.团队中的架构师会通过建模确定应用程序是否满足客户的需求. 你可以创建不同级 ...
- Visual Studio 2010中创建ASP.Net Web Service
转自:http://blog.csdn.net/xinyaping/article/details/7331375 很多人在论坛里说,在Visual Studio 2010中不能创建“ASP.Net ...
- 在 Visual Studio 2010 中创建 ASP.Net Web Service
第一步:创建一个“ASP.Net Empty Web Application”项目 第二步:在项目中添加“Web Service”新项目 第一步之后,Visual Studio 2010会创建一个仅含 ...
- (转)在 Visual Studio 2010 中创建 ASP.Net Web Service
很多人在论坛里说,在Visual Studio 2010中不能创建“ASP.Net Web Service”这种project了,下面跟帖者云云,有的说这是因为微软已经将Web Service整合进W ...
- [转]基于Visual Studio 2010 进行敏捷/Scrum模式开发
http://www.infoq.com/cn/articles/visual-studio-2010-agile-scrum-development 根据Forrester Research今年第二 ...
- 用Visual Studio 2010 打开Visual Studio 2013 (C#专用)
1.更改.sln 1)将Microsoft Visual Studio Solution File, Format Version 12.00 改成11.00 2)将 # Visual Studi ...
- 在Visual Studio 2010/2012中 找不到创建WebService的项目模板
参考文章: http://blog.sina.com.cn/s/blog_6d545999010152wb.html 在 Visual Studio 2010 或者2012的新建 Web 应用程序或者 ...
- Microsoft Visual Studio 2010中文版编译SQLlite3.7.0版
作为一名教师,没有具体项目的开发,却喜欢尝鲜,不经意间开始追星了. 换了Win7,安装了Microsoft Visual Studio 2010中文版,7月22日SQLite发布了3.7.0版.当然想 ...
- Visual Studio 2010 中的 Web 开发
概述 Microsoft Visual Studio 2010 为 ASP.NET Web 应用程序的开发提供非常多新的功能.这些新功能旨在帮助开发者高速方便地创建和部署质量高且功能全的 Web 应用 ...
随机推荐
- MongoDB用户权限基本操作
查看当前数据库的全部用户 > show users{ "_id" : ObjectId("4dedeeae26e7516d69948e33" ...
- webdriver中处理alert
1 定义isAlertPresent()供调用: public boolean isAlertPresent() { try { driver.switchTo().alert(); re ...
- [CareerCup] 17.14 Unconcatenate Words 断词
17.14 Oh, no! You have just completed a lengthy document when you have an unfortunate Find/Replace m ...
- [zt]矩阵求导公式
今天推导公式,发现居然有对矩阵的求导,狂汗--完全不会.不过还好网上有人总结了.吼吼,赶紧搬过来收藏备份. 基本公式:Y = A * X --> DY/DX = A'Y = X * A --&g ...
- vsphere平台为win系统动态扩展磁盘
1.关闭win虚拟机 2.在vcenter管理中加大磁盘空间 3.开启win虚拟机(此时磁盘并没有加大) 4.打开cmd命令行: 进入分区管理--->查看磁盘--->选择磁盘---> ...
- House Robber
You are a professional robber planning to rob houses along a street. Each house has a certain amount ...
- css3 半个字符美化方法
<html lang="zh-CN"> <head> <title></title> <meta charset=" ...
- 全选,不选,反选 jquery
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 全选,不选,反选js
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name ...
- Runtime Error---Description: An application error occurred on the server....
[原]Runtime Error---Description: An application error occurred on the server.... 2010-1-7阅读2010 评论3 D ...