当前位置: 移动技术网 > IT编程>开发语言>c# > C#简单访问SQLite数据库的方法(安装,连接,查询等)

C#简单访问SQLite数据库的方法(安装,连接,查询等)

2019年07月18日  | 移动技术网IT编程  | 我要评论

本文实例讲述了c#简单访问sqlite数据库的方法。分享给大家供大家参考,具体如下:

下载最新版sqlite(),其他版本也可以,这里使用的版本是

a.解压后copy c:\sqlite-3_6_6_1

b.进入cmd模式,进入sqlite-3_6_6_1目录,执行sqlite3 mytest.db

c.

create table test (seq int,desc varchar(8));
insert into mytable1 values (1,'item');

资料建立完成

2.下载system.data.sqlite(),安装,安装后里面会有详细的demo和文档。请详细查看。

3.将mytest.db复制到bin/debug目录下。

4.打开vs2005,参考system.data.sqlite安装目录下的system.data.sqlite.dll

using system.data.sqlite;
sqliteconnection cnn = new sqliteconnection();
cnn.connectionstring = @"data source=mytest.db;pooling=true;failifmissing=false"
cnn.open();
sqlitecommand cmd = new sqlitecommand();
cmd.connection = cnn;
cmd.commandtext = "select * from test";
sqlitedataadapter da = new sqlitedataadapter();
da.selectcommand = cmd;
dataset ds = new dataset();
da.fill(ds);
// 分页查询显示语句
select * from test limit 10 offset 10;

以上语句表示从account表获取数据,跳过10行,取10行

更多关于c#相关内容感兴趣的读者可查看本站专题:《c#程序设计之线程使用技巧总结》、《c#操作excel技巧总结》、《c#中xml文件操作技巧汇总》、《c#常见控件用法教程》、《winform控件用法总结》、《c#数据结构与算法教程》、《c#数组操作技巧总结》及《c#面向对象程序设计入门教程

希望本文所述对大家c#程序设计有所帮助。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网