Ket Noi SQLite Voi Csharp
Ket Noi SQLite Voi Csharp
Ket Noi SQLite Voi Csharp
http://www.codeproject.com/KB/cs/SQLiteCSharp.aspx
Introduction
SQLite is a small, fast and embeddable database where the database engine and the
interface are combined into a single library. It also has the ability to store all the data in a
single file. So if your application requires a standalone database, SQLite is perhaps the
perfect choice for you. There are, of course, other reasons for choosing SQLite including:
SQLite has a small memory footprint and only a single library is required to access
databases, making it ideal for embedded database applications.
SQLite has been ported to many platforms and runs even on Windows CE and Palm
OS.
SQLite implements a large subset of the ANSI-92 SQL standard, including views,
sub-queries and triggers.
No problem of extra database drivers, ODBC configuration required. Just include the
library and the data file with your application.
SQLite has native language APIs for C/C++, PHP, Perl, Python, Tcl etc. Native API for
C# is still not present.
To use SQLite in your C# application, you need to download a third party free ADO.NET
data provider (SQLite.NET.0.21_x68_dll.zip) from here.
Fig 1: Demo C# SQLite application.
Our demo application uses SQLite database to store id and description value pairs in a
single table mains. We will display the contents of this table in a grid with added
functionalities of adding/deleting and modifying records to and from the table. To set up the
system, please follow the steps below:
1. Unzip the archive, and place the *.dll files into the Binary folder.
2. Use the SQLite.NET.dll in your .NET application by Project -> Add Reference.
Conclusion
Like all databases, SQLite has its list of shortcomings. It is not suitable for a client server
application or as a networked database. Its not suited well for a multi user scenario and can
have serious file locking issues when accessed simultaneously over the network. Quite for
the same reason, SQLite is not suited for a multi-threaded or a multi-process application-
database access scenario.
To conclude, SQLite is very suitable for memory constraint systems like WinCE, Palms,
Smart Phones, embedded devices and also normal single user desktop applications where
its small memory footprint, single library and its copy and paste deployment feature give it
a distinct advantage.
Pre-requisites