Use SQLite database in. net

Source: Internet
Author: User
Tags sqlite database

We all know that programs developed with. Net generally use SQL Server databases. But it is not suitable for some small projects. First, there is no need to install SQL Server for small projects, and second, the License of SQL Server is too expensive, not suitable for small projects.

MySQL, access, and SQLite are recommended for small projects. Access can be used directly in systems earlier than xp. MySQL requires a 30 M installation package or a local file package of over 10 m in windows. I used to use access all the time, but recently I found that the SQLite database is very good. I would like to introduce it to you.

In fact, SQLite is well known in embedded programs and is completely free of charge. Official Website for http://www.sqlite.org/

SQLite, like access, is a single file. That is to say, without the database engine, the database file is a file on the disk. SQLite also supports indexes, views, and triggers. These are better than access.

Good management tools are also required. I recommend SQLite administrator or sqlitespy. You can find their latest version online. The following are two figures: the first is SQLite administrator and the second is sqlitespy.

 

 

The above two tools can complete the general work of SQLite. For example, database creation, table creation, and query.

If you want to connect to and operate SQLite using. net, you must download the SQLite class library system. Data. SQLite. dll, which can be found on Microsoft's official website. Then reference this DLL in the program. Similar to ado.net, it connects to SQL Server and also has controls such as connect, command, and adapter. The specific operations will not be mentioned.

In terms of usage, I found a problem, that is, the newline carriage return (/R/N) is saved in the SQLite database, and is converted to/N in SQLite, that is, the string read from SQLite must be converted using Replace ("/N", "/R/N"). Otherwise, all the characters will be connected and the carriage return will be skipped.

I have used SQLite in a recent project and it feels good. So I will share it with you. Please kindly advise on anything wrong.

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.