VS2010 connecting to the SQLite database

Source: Internet
Author: User
Tags sqlite sqlite database visual studio 2010

Visual Studio 2010 and later, connect to SQLite database

1. Download SQLite. EXE installation package at SQLite development site

Ctrl+f Search for this statement: The is capable of installing, the Design-time components for Visual Studio xxxx

Find the corresponding VS version, be sure to bring bundles, integrated with the designer, regardless of 32-bit system or 64-bit system, it seems to download 32-bit (X86)

Such as:

Otherwise, when you want to add a new database in Visual Studio, there is no sqlite option, and when downloaded correctly and installed, you can see SQLite in VS:

2. Connect to the database

Add Connection--database:db File

2, VS2010 pull a button and DataGridView in the form, implement the Click button, in the DataGridView display the data in the database

   private void Button1_Click (object sender, EventArgs e)        {            using (sqliteconnection con = new Sqliteconnection ( Constants.data_source))            {                con. Open ();                using (sqlitecommand cmd = new Sqlitecommand ()))                {                    cmd. Connection = con;                    Cmd.commandtext = string. Format ("select * from  jy_cdjy_cdjyhgz");                    int rows = cmd. ExecuteNonQuery ();                    Sqlitedataadapter Orada = new Sqlitedataadapter (cmd);                    DataSet ds = new DataSet ();                    Orada.fill (DS);                    Con. Close ();                    DataTable dtbl = ds. Tables[0];                    This.dataGridView1.DataSource = Dtbl;}}        }

  

Reference:

http://blog.csdn.net/missautumn/article/details/18567715

VS2010 connecting to the SQLite database

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.