SQLite 数据库使用方法

介绍:
1.SQLite是一个开源的,轻量级的,支持多平台的数据库。
2.SQLite是一个嵌入式SQL数据库引擎,没有独立的服务进程。
3.SQLite直接读写磁盘文件,表、索引、触发器和视图的完整SQL数据库就包含在一个
独立的磁盘文件中。

使用方法:
1.将 dll文件放入bin目录下
2.添加web引用
3.using System.Data.SQLite;
4.配置文件:
<add name="sqlite" connectionString="Data
Source=|DataDirectory|\leeCMS;Pooling=true;FailIfMissing=false"
providerName="LITE"/>

5.操作代码,与操作sql库一样,只是类名不一样.

using (SQLiteConnection conn = new SQLiteConnection(connStr))
{
SQLiteDataAdapter da = new SQLiteDataAdapter("select * from
testT", conn);
DataTable dt = new DataTable();
da.Fill(dt);
GridView1.DataSource = dt.DefaultView;
GridView1.DataBind();
}

posted on 2012-02-11 17:31  woshilee  阅读(446)  评论(0)    收藏  举报

导航