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.