大家好![](https://zoearth1024moon99nas.direct.quickconnect.to/plugins/editors-xtd/zoearth_insert_emoticons_btn/imgs/756d.gif)
![](https://zoearth1024moon99nas.direct.quickconnect.to/plugins/editors-xtd/zoearth_insert_emoticons_btn/imgs/756d.gif)
最近遇到一個問題
因為我接前同事寫的程式
但是我對於C#經驗不多![](https://zoearth1024moon99nas.direct.quickconnect.to/plugins/editors-xtd/zoearth_insert_emoticons_btn/imgs/b887.gif)
![](https://zoearth1024moon99nas.direct.quickconnect.to/plugins/editors-xtd/zoearth_insert_emoticons_btn/imgs/b887.gif)
看到它裡面有寫入資料庫
且資料庫是類似 sqlite 那樣的本地端資料庫檔案
覺得相當特別...
但是一時之間找不到讀取 SDF檔案的方法
一開始有看到有人建議 LINQPad 這軟體![](https://zoearth1024moon99nas.direct.quickconnect.to/plugins/editors-xtd/zoearth_insert_emoticons_btn/imgs/5ff6.gif)
![](https://zoearth1024moon99nas.direct.quickconnect.to/plugins/editors-xtd/zoearth_insert_emoticons_btn/imgs/5ff6.gif)
Download and install LINQPad, it works for SQL Server, MySQL, SQLite and also SDF (SQL CE 4.0).
Steps for open SDF Files:
-
Click Add Connection
-
Select Build data context automatically and Default (LINQ to SQL), then Next.
-
Under Provider choose SQL CE 4.0.
-
Under Database with Attach database file selected, choose Browse to select your .sdf file.
-
Click OK.
但是用一用發現
確實可以讀取...但是要匯出什麼的都很麻煩
且有鎖定功能,他是要收費的軟體...![](https://zoearth1024moon99nas.direct.quickconnect.to/plugins/editors-xtd/zoearth_insert_emoticons_btn/imgs/35c9.gif)
![](https://zoearth1024moon99nas.direct.quickconnect.to/plugins/editors-xtd/zoearth_insert_emoticons_btn/imgs/35c9.gif)
所以我後來又找一找
發現 visualstudio 本身就可以讀取SDF且功能完整了![](https://zoearth1024moon99nas.direct.quickconnect.to/plugins/editors-xtd/zoearth_insert_emoticons_btn/imgs/0fa3.gif)
![](https://zoearth1024moon99nas.direct.quickconnect.to/plugins/editors-xtd/zoearth_insert_emoticons_btn/imgs/0fa3.gif)
SQLite/SQL Server Compact Toolbox
安裝後就會出現
左邊就有工具箱
打開之後輸入 檔案位置 與 大小 與 密碼
就可以存取囉!![](https://zoearth1024moon99nas.direct.quickconnect.to/plugins/editors-xtd/zoearth_insert_emoticons_btn/imgs/756d.gif)
![](https://zoearth1024moon99nas.direct.quickconnect.to/plugins/editors-xtd/zoearth_insert_emoticons_btn/imgs/756d.gif)
也有匯出語法
有這些基本語法方便很多![](https://zoearth1024moon99nas.direct.quickconnect.to/plugins/editors-xtd/zoearth_insert_emoticons_btn/imgs/fc7e.gif)
![](https://zoearth1024moon99nas.direct.quickconnect.to/plugins/editors-xtd/zoearth_insert_emoticons_btn/imgs/fc7e.gif)
給大家參考囉!
感恩![](https://zoearth1024moon99nas.direct.quickconnect.to/plugins/editors-xtd/zoearth_insert_emoticons_btn/imgs/0fa3.gif)
![](https://zoearth1024moon99nas.direct.quickconnect.to/plugins/editors-xtd/zoearth_insert_emoticons_btn/imgs/0fa3.gif)
留言板
歡迎留下建議與分享!希望一起交流!感恩!