Codsmith软件下载页面:http://www.ibeifeng.com/down.php?id=36606
CodeSmith开发系列资料总结@H_301_5@ http://terrylee.cnblogs.com/archive/2005/12/28/306254.aspx
sqlite驱动下载页面:http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
Navicat for sqlite管理工具下载页面:http://www.pc6.com/softview/SoftView_57268.html
下载三个驱动文件:
http://system.data.sqlite.org/downloads/1.0.82.0/sqlite-netFx40-setup-bundle-x86-2010-1.0.82.0.exe
实际上只要装此集合包就行了,装之前关闭VS2010 , 之后打开服务器资源管理器 -> 添加连接
http://system.data.sqlite.org/downloads/1.0.82.0/sqlite-netFx40-setup-x86-2010-1.0.82.0.exe
http://sourceforge.net/projects/sqlite-dotnet2/files/SQLite%20for%20ADO.NET%202.0/(选择最新版本的sqlite-1.0.66.0-setup.exe下载)
C开发环境中 ,需要下载sqlite源码包,其中引入sqlite3.c、sqlite.h即可
下载: sqlite-amalgamation-3071400.zip
//创建一个数据库文件
//string datasource = "d:/test.db";
//System.Data.sqlite.sqliteConnection.CreateFile(datasource);
//连接数据库
sqliteConnection conn = new sqliteConnection();
sqliteConnectionStringBuilder connstr = new sqliteConnectionStringBuilder();
connstr.DataSource = "E:/test/test.db";
//connstr.Password = "admin";//设置密码,sqlite ADO.NET实现了数据库密码保护
conn.ConnectionString = connstr.ToString();
conn.Open();
//创建表
//sqliteCommand cmd = new sqliteCommand();
//string sql = "CREATE TABLE test(username varchar(20),password varchar(20))";
//cmd.CommandText = sql;
//cmd.Connection = conn;
//cmd.ExecuteNonQuery();
//插入数据
sqliteCommand cmd = new sqliteCommand();
string sql = "INSERT INTO userinfo VALUES(10,'lcd','123456')";
cmd.CommandText = sql;
cmd.Connection = conn;
cmd.ExecuteNonQuery();
//取出数据
sql = "SELECT * FROM userinfo";
//select c.rowid from userinfo可以获取到数据库行id cmd.CommandText = sql; sqliteDataReader reader = cmd.ExecuteReader(); String username = ""; String password = ""; while (reader.Read()) { username = reader.GetString(1); password = reader.GetString(2); } MessageBox.Show(username + ";" + password);
原文链接:https://www.f2er.com/sqlite/200609.html