【SQLite】可視化工具SQLite studio

 SQLite數據庫的特性

特色:html

1.輕量級
2.獨立性,沒有依賴,無需安裝
3.隔離性 所有在一個文件夾系統
4.跨平臺 支持衆多操做系統
5.多語言接口 支持衆多編程語言
6.安全性 事物,經過獨佔性和共享鎖來實現獨立事務的處理,多個進程能夠在同一個時間內從同一個數據庫讀取數據,但只有一個能夠寫入數據
所支持的數據類型:sql

支持NULL,INTEGER,Real,text,blob數據類型
一次表明,空值,整型值,浮點值,字符串類型,二進制對象,
動態類型引用(弱引用)
當某個值插入到數據庫是,SQlite將會檢查他的類型,若是該類型與關聯的列不匹配,SQlite則會嘗試將改制轉換成該列的類型,若是不能轉換,則該值將做爲自己的類型儲存數據庫

使用須知:
沒有可用於SQlite的網絡服務器,只能經過網絡共享可能存在文件鎖定或者性能問題。
沒有用戶帳戶的概念,而是根據文件系統的共享設置。
支持數據庫大小至2TB。編程

 

 SQLite的可視化工具

下載地址:https://sqlitestudio.pl/index.rvt?act=download安全

 

 Windows下操做

下載服務器

 

解壓後,運行exe文件網絡

 

新建個數據庫文件app

連接數據庫文件編程語言

 

路徑和名稱設置好後,點擊連接測試ide

 

 

而後點擊OK 就完成了!

 

 SQLite菜鳥教程連接:http://www.runoob.com/sqlite/sqlite-tutorial.html

 

SQLite不支持drop column,因此刪除一列仍是和通常sql語句仍是有點區別的,下面Dapper對sqlite進行增刪改查

<connectionStrings>
    <add name="SQLiteCon" connectionString="Data Source=D:\DBFile\SQLite\Test.db;Version=3" providerName="System.Data.SQLite" />
  </connectionStrings>

 

public void SQLiteMethod() { using (DbBase db = CreateDB.CreateDbBase()) { //新增列
                int a = db.Execute(@"ALTER TABLE Student ADD 'SEX' varchar"); //刪除列 //1.首先根據Student表建立一張新表Student2 //2.而後咱們刪除Student這個表 //3.將Student2這個表重命名爲Student
                var tran = db.DbTransaction; int b1 = db.Execute(@"CREATE TABLE Student2 as select ID,NAME,ADDRESS FROM Student ", tran); int b2 = db.Execute(@"DROP TABLE if exists Student ", tran); int b3 = db.Execute(@"ALTER TABLE Student2 rename to Student ", tran); if (b1 == 0 && b2 == 0 && b3 == 0) { tran.Commit(); } else { tran.Rollback(); } //
                int index = db.Execute(@"INSERT INTO Student(ID,NAME,ADDRESS) VALUES(1, '李四', '東方明珠') "); //
                int index2 = db.Execute(@"DELETE FROM Student WHERE ID = 1 "); //
                var updateSql = "UPDATE Student SET NAME='李白' WHERE ID=@ID"; bool res = db.Update<Student>(updateSql, new { ID = 1 }); //
                string selectSql = @"SELECT * FROM Student "; var student = db.Query<Student>(selectSql); //批量插入
                bool resBatch = db.InsertBatch<Student>(student); } }

 

 

 

 

EF建表

相關文章
相關標籤/搜索