SQLite question Notes

Source: Internet
Author: User
Tags sqlite sqlite database connectionstrings

1. In the SQLite database, the data type returned by Interger is Int64 bit. If you want to convert to C # int type, you must first convert to Int64 and then to int type. Such as:

int id = (int) (Int64) dt.rows[0]["id"];

The int type is converted to C#int and can be converted directly, such as:

int isdel = (int) dt.rows[0]["Isdel"];

2. When the database is established, the self-increment field must be of type Interger.

3. Password-free string connection:

SqlHelper part of the content

Private Static stringstrconn = configurationmanager.connectionstrings["Adostr"].        ConnectionString;  Public Static intExecuteNonQuery (stringSqlparamssqliteparameter[] Parameters) {            using(Sqliteconnection conn =Newsqliteconnection (strconn)) {Conn.                Open (); using(Sqlitecommand cmd =Conn. CreateCommand ()) {Cmd.commandtext=SQL; Cmd.                    Parameters.addrange (Parameters); returncmd.                ExecuteNonQuery (); }            }        }
View Code

App.

<?xml version="1.0" encoding="utf-8" ?>< configuration>  <connectionStrings>    <add name="adostr" connectionstring="Data source=e:/sqlite/data/passworddb.db"/>  </ Connectionstrings></configuration>
View Code

SQLite question Notes

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.