Csharp使用ADO.NET操作SQLite

SQLite是一個簡易的資料庫系統,開放原始碼,可以直接把SQLite綁在程式裡使用,FireFox及Android等軟體也都有內建SQLite。SQLite不需要安裝,看起來就只是一個檔案而已,也可以使用memory模式,讓它存在記憶體中而不需要建立一個檔案存放。

SQLite支援的SQL指令:http://www.sqlite.org/lang_corefunc.html

C#要連接SQLite可以使用open source的System.Data.SQLite,它是一個基於ADO.Net所做與SQLite的溝通介面,目前支援到.net framework 3.5。可於sourceforge下載其dll來使用,就可以了。

下方的範例是介紹如何在Csharp下使用ADO.NET連接與操作SQLite,包含了自動產生SQLite檔案與DataGridView使用class binding datasource方法。

一、建立一個專案,並先將其儲存起來

(需要先建置專案才能使用專案裡的class當做datasource)

01.jpg
02.jpg

二、改變專案使用的Framework

Read More

Java use JDBC connect SQLite

SQLite is a lightweight database system that can be used without installation and can be easily embedded in the system.

SQLite is written in C language, and it can cross Linux and Windows platforms. You can use JDBC to connect to SQLite for Java access and operation.

On JDBC connection to SQLite, it is roughly divided into two ways. One is to connect the data by Pure-Java, and the other is to call the function library written in C directly from Java. The method should be faster, but in platforms where a suitable C function library cannot be found, the Pure-Java version can be used.

SQLite JDBC github , This Example support create Table、drop Table、Query table、insert、delete and Update…

https://github.com/catyku/SQLiteExample

Read More