SQLite Use note (from: http://blog.bossma.cn/database/sqlite_use_record)

Source: Internet
Author: User

SQLite is a lightweight database engine that features independence, embedding, and zero configuration. It can be used as an alternative to access or MySQL, and is especially suitable for small and medium websites and embedded applications, the current version is 3.7.4.

1. Download the program

: Http://www.sqlite.org/download.html

Different versions are available for different operating systems.

Download precompiled binaries for Windows

There are three files in total:

Sqlite-shell-win32-x86-3070400.zip: a command line interface tool for accessing and modifying SQLite.

Sqlite-dll-win32-x86-3070400.zip: SQLite library.

Sqlite-analyzer-win32-x86-3070400.zip: an analytic program

2. Create a database:

(1) Use SQLite Shell

Double-click the sqlite3.exe file and enter the following command:

This tool creates a temporary database in the memory. Here, a table is created, data is added, data is queried, and data is backed up to customer. DB3.

You can also use "sqlite3 database file full name" in the command line to create a database:

(2) Use other management tools

SQLite has some open-source or free management tools, such:

SQLite expert personal: SQLite
Free version of expert

Sqlitestudio: gplv2 Open Source

Using these tools is as simple as using access and sqlserver management tools:

3. access in the. NET Program

(1) download and install SQLite. net.

(2) create a new website in Visual Studio 2008, add references, and find "system. Data. SQLite" on the ". Net" tab ".

(3) Add the sqlitehelper generic data access operation class to the app_code folder.

Copy a copy from here: http://www.cnblogs.com/viaivi/archive/2009/01/07/1370978.html

(4) create a page for adding and displaying data:

Protected void page_load (Object sender, eventargs e) {If (! Ispostback) {textbox2.text = datetime. now. tostring (); sqlitedatareader reader = sqlitehelper. executereader (system. data. commandtype. text, "select * from customer", null); gridview1.datasource = reader; gridview1.databind (); reader. close () ;}} protected void button#click (Object sender, eventargs e) {sqliteparameter [] paras = new sqliteparameter [] {New sqliteparameter ("@ companyName", system. data. dbtype. string), new sqliteparameter ("@ addtime", system. data. dbtype. datetime)}; paras [0]. value = textbox1.text; paras [1]. value = textbox2.text; // return the inserted primary key ID // use select last_insert_rowid () to return the value of the auto-increment field int addid = convert. toint32 (sqlitehelper. executescalar (system. data. commandtype. text, "insert into customer values (null, @ companyName, @ addtime); select last_insert_rowid ()", paras ));}

4. Reference website:

SQLite Chinese site: http://www.sqlitecn.org/

SQLite. Net: The http://sqlite.phxsoftware.com/

Sqlitehelper: http://www.cnblogs.com/viaivi/archive/2009/01/07/1370978.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.