C # connect to SQLite

Source: Internet
Author: User

Without talking nonsense, go to the subject:

1. SQLite Introduction: lightweight, open-source, and embedded relational databases.

2. Download sqlite-shell-win32

3. sqlite.net download (used for winform and other projects to interact with SQLite and provide DLL connections) PS:. net3.5 download this file. Another. net3.5 test found a problem and encountered an exception.

4. Download The SQLite-GUI tool (SQLite expert professional 3), which is quite powerful and supports importing CSV files.

5. decompress the downloaded SQLite file and reference it to the project. After successful reference, the following message is displayed: (Drinking method: Right-click the project name, add reference, browse, and add it to the Project)

6. Database Connection example:

Time shuttle View

7,C # SQLite error: Unable to load DLL "SQLite. InterOP. dll", unable to find the specified Module

8. traverse the result set

Foreach (datatable DT in datas. Tables)
{
Foreach (datarow DR in DT. Rows)
{
Foreach (datacolumn DC in DT. columns)
{
MessageBox. Show (string. Format ("{0}, {1}, {2}", DT. tablename, DC. columnname, Dr [DC]);
}
}
}

 

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.