sqllite -尊龙游戏旗舰厅官网
sqlliteexpert下载
http://www.sqliteexpert.com/download.html3
technorati 标签: c# sqllite
注意事项:
1、 ado.net provider for sqlite 1.0.66版并不支持vs2005、只能在vs2008上用,使用vs2005的请用旧版。
其中安装目录下wm的dll需要把dll和lib文件名中的066去掉,否则在wm上不能使用。
2、sqlite的图形ui最好用sqlite expert personal,免费的,只不过英文版,支持utf-8,不会乱码。sqliteadmin虽然支持中文界面,但数据容易乱码(不支持utff-8)。下载地址:http://www.sqliteexpert.com/download.html
3、sqlite的路径最好这样写(取数据库绝对路径):path.getdirectoryname(system.reflection.assembly.getexecutingassembly().getname().codebase) \\sqlitetest.db" ,否则容易报错,因为sqlite是不支持相对路径数据库文件位置,只支持绝对路径,而且如果在指定路径没找到,sqlite还会在指定路径自建一个指定名称的数据库,同时报找不到指定表的错误,引起误解。
收集sqlite与sql server的语法差异 :
1.返回最后插入的标识值
返回最后插入的标识值sql server用@@identity
sqlite用标量函数last_insert_rowid()
返回通过当前的 sqlconnection 插入到数据库的最后一行的行标识符(生成的主键)。此值与 sqlconnection.lastinsertrowid 属性返回的值相同。
2.top n
在sql server中返回前2行可以这样:
select top 2 * from aa
order by ids desc
sqlite中用limit,语句如下:
select * from aa
order by ids desc
limit 2
3.getdate ( )
在sql server中getdate ( )返回当前系统日期和时间
sqlite中没有
4.exists语句
sql server中判断插入(不存在ids=5的就插入)
if not exists (select * from aa where ids=5)
begin
insert into aa(nickname)
select 't'
end
在sqlite中可以这样
insert into aa(nickname)
select 't'
where not exists(select * from aa where ids=5)
5.嵌套事务
sqlite仅允许单个活动的事务
6.right 和 full outer join
sqlite不支持 right outer join 或 full outer join
7.可更新的视图
sqlite视图是只读的。不能对视图执行 delete、insert 或 update 语句,sql server是可以对视图 delete、insert 或 update
sqlite查询数据库中存在的所有表
from within a c/c program (or a script using tcl/ruby/perl/python bindings) you can get access to table and index names by doing a select on a special table named "sqlite_master ". every sqlite database has an sqlite_master table that defines the schema for the database.
sql codeselect name from sqlite_master
where type='table' order by name;
总结
- 上一篇: [转].net 数字格式化:忽略末尾零
- 下一篇: python 日志打印