`
tomgooityeeee
  • 浏览: 72212 次
文章分类
社区版块
存档分类
最新评论

[转]c#访问sqlite数据库

    博客分类:
  • java
阅读更多
    <p>本文转自:<a href="http://hi.baidu.com/netlmz/blog/item/326c644fa919a9cdd1c86a11.html" target="_blank">http://hi.baidu.com/netlmz/blog/item/326c644fa919a9cdd1c86a11.html</a></p><p>原文如下:</p><p>下载最新版sqlite(http://www.sqlite.org/download.html),其他版本也可以,目前版本是<font color="#734559"><a href="http://www.sqlite.org/sqlite-3_6_6_1.zip" target="_blank"><font color="#734559">sqlite-3_6_6_1</font></a></font><br><br> a.解压后copy c:\sqlite-3_6_6_1<br><br> b.进入cmd模式,进入sqlite-3_6_6_1目录,执行sqlite3 mytest.db <br><br> c.create table test (seq int,desc varchar(8));insert intotest values (1,'item');资料建立完成 <br><br>2.下载system.data.sqlite(http://sqlite.phxsoftware.com/),安装,安装后里面会有详细的demo和文档。请详细查看。</p><p>3.将mytest.db复制到bin/debug目录下。<br><br>3.打开vs2005,参考system.data.sqlite安装目录下的system.data.sqlite.dll</p><p> using system.data.sqlite;<br><br> sqliteconnection cnn = new sqliteconnection(); <br> cnn.connectionstring = @"data source=mytest.db;pooling=true;failifmissing=false"<br> cnn.open(); <br> sqlitecommand cmd = new sqlitecommand(); <br> cmd.connection = cnn; <br> cmd.commandtext = "select * from test"; <br> sqlitedataadapter da = new sqlitedataadapter(); <br> da.selectcommand = cmd; <br> dataset ds = new dataset(); <br> da.fill(ds);</p><p>// 分页查询显示语句</p><p>select * from test limit 10 offset 10; <br>以上语句表示从test表获取数据,跳过10行,取10行</p> 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics