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 数字格式化:忽略末尾零
- 下一篇: IPv6 auto config 原理详