C# 操作 sqlite

1、下载sqlite:http://system.data.sqlite.org/downloads/1.0.94.0/sqlite-netFx20-setup-bundle-x86-2005-1.0.94.0.exe

2、安装下载到的文件:sqlite-netFx20-setup-bundle-x86-2005-1.0.94.0.exe

3、右键C#项目属性:

4、【应用程序】标签中的【目标框架】改成:.NET Framework 3.5

5、【生成】标签中的【目标平台】改成:x86

6、添加引用刚刚sqlite安装路径下的System.Data.SQLite.dll文件,默认路径为:C:Program Files (x86)System.Data.SQLite2005in

7、引入命名空间:using System.Data.SQLite;

完成!

测试代码:SQLiteConnection.CreateFile("test.sqlite");

运行后,可找到项目文件夹的binDebug路径下,生成的test.sqlite数据库文件。

原文地址:https://www.cnblogs.com/fengrenyuan/p/4200877.html