SQLite Database Encryption

Source: Internet
Author: User
Submit a search form
SQLite Database Encryption

1. Create an empty SQLite database.

// You can directly specify the suffix of the database name, even without a suffix.
// Method 1: Create an empty SQLite database using Io
Filestream FS = File. Create ( " C: \ test. DB " );
// Method 2: Use sqliteconnection
Sqliteconnection. createfile ( " C: \ test. DB " );

The created database is a 0-byte file.

2. Create an encrypted empty SQLite Database

// Create an empty SQLite database with a password
Sqliteconnection. createfile ( " C: \ test2.db " );
Sqliteconnection CNN =   New Sqliteconnection ( " Data Source = C :\\ test2.db " );
Sqliteconnection CNN =   New Sqliteconnection ( " Data Source = D :\\ test2.db " );
CNN. open ();
CNN. changepassword ( " Password " );

3. Encrypt unencrypted Databases

Sqliteconnection CNN =   New Sqliteconnection ( " Data Source = C :\\ test. DB " );
CNN. open ();
CNN. changepassword ( " Password " );

4. Open the encrypted SQLite Database

// Method 1
Sqliteconnection CNN =   New Sqliteconnection ( " Data Source = C :\\ test2.db " );
CNN. setpassword ( " Password " );
CNN. open ();
// Method 2
Sqliteconnectionstringbuilder =   New Sqliteconnectionstringbuilder ();
Builder. datasource =   @ "C : \ Test. DB " ;
Builder. Password =   @" Password " ;
Sqliteconnection CNN =   New Sqliteconnection (builder. connectionstring );
CNN. open ();

Paging

Select * from messages limit 10,100;

This indicates that 10 rows are skipped and the returned results of 100 rows are taken.

Select * from messages limit 10,100;

This indicates that 10 rows are skipped and the returned results of 100 rows are taken.

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.