最終更新:2011-02-01 (火) 12:44:53 (4999d)
System.Data.SQLite
Top / System.Data.SQLite
System.Data.SQLite is the original SQLite database engine and a complete ADO.NET 2.0/3.5 provider all rolled into a single mixed mode assembly. It is a complete drop-in replacement for the original sqlite3.dll (you can even rename it to sqlite3.dll if you're using it natively).
http://sqlite.phxsoftware.com/
Here is a brief overview of its features:
- Complete ADO.NET 2.0 Implementation
- Supports the Full and Compact .NET Framework as well as native C/C++
- Mono support
- Support for the ADO.NET 3.5 Entity Framework
- Visual Studio 2005/Visual Studio 2008 Design-Time Support
- Completely portable database files
- Incredibly fast, faster than most every other embedded database, including Sql Server Mobile
- Encryption Support
- Single file redistributable under 900kb
- Extensive SQL support
- User-Defined Functions & Collating Sequences
- Full Source Included. 100% Free.
例
using (SQLiteConnection cnn = new SQLiteConnection("Data Source=mydatabase.db")) using (SQLiteCommand cmd = cnn.CreateCommand()) { cnn.Open(); // Create a new table cmd.CommandText = "CREATE TABLE FOO ([ID] INTEGER PRIMARY KEY, [MyValue] NVARCHAR(256)"; cmd.ExecuteNonQuery(); // Create the table, don't expect returned data // Insert something into the table cmd.CommandText = "INSERT INTO FOO (MyValue) VALUES('Hello World')"; cmd.ExecuteNonQuery(); // Read the values back out cmd.CommandText = "SELECT * FROM FOO"; using (SQLiteDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { Console.WriteLine(String.Format("ID = {0}, MyValue = {1}", reader[0], reader[1])); } } }