LINQ to SQLite

Source: Internet
Author: User
Step 1: import data to the project in mongodblinq. dll, dblinq. SQLite. dll, system. Data. SQLite. dll, and system. Data. SQLite. LINQ. dll.

Step 2: Execute dbmetal.exe in workshop and enter the database configuration according to the help prompt.
Example: dbmetal.exe-c "dblinqprovider = SQLite; Data Source = test. DB" -- provider = SQLite -- database = testdb -- code = testdb. CS (Testdb. CS is the class file that will inherit datacontext, and testdb is the class name)

Step 3: place the generated file in the Dal layer or app_code of your project and call it in the Aspx. CS or form. CS file.
Example:

C # code

Sqliteconnection con= NewSqliteconnection ("Dblinqprovider = SQLite; Data Source = test. DB");
Testdb DB= NewTestdb (CON );
Gridview1.datasource=DB. tablename;
Gridview1.databind ();

Note: You must use sqliteconnection to create a database connection. If you directly add the connection string to the constructor parameter, an error may be reported.

about how to use the SQLite database, let's also talk about:
download the SQLite database browser software on www.sf.net and click "new" to specify the database directory, name it test. db3 or test. all databases are supported. This file is the database, and then you can use SQLite database browser to create tables, add fields, and change the data type for the test database, which is very convenient.

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.