I still am unable to figure this out and have tried many variations to try and create a encrypted database and create the tables in the new encrypted database. I'm trying:
DB.Initialize(Dir, "MyDb.db", True)
If File.Exists(Dir, "MyDbE.db") Then
DB.ExecNonQuery("ATTACH DATABASE '" & File.Combine(Dir, "MyDbE.db") & "' AS MyDbE")
txt="CREATE TABLE IF NOT EXISTS MyDbE.TableData AS SELECT * FROM TableData"
Where MyDb is the unencrypted database and MyDbE is the encrypted one. When I go back and try to access the table after initializing I get "Unknown Database.
I'm just trying to:
1) create a encrypted SqlCipher database
2) Copy my tables from the unencrypted database to the encrypted database
3) Be able to read and write to the encrypted database or unencrypted database.
For how simple the tutorial is, I sure haven't been able to figure this out after many hours.
1. Open the unencrypted database with SQL.
2. Create a new database with SQLCipher.
3. Create the tables in the new database.
Now do something like:
Dim rs As ResultSet = SQL.ExecuteQuery("SELECT * FROM table")
Do While rs.NextRow
SQLCipher1.AddNonQueryToBatch("INSERT INTO table VALUES (?, ?)", Array(rs.GetString("column1"), rs.GetInt("column2"))
Dim SenderFilter As Object = SQLCipher1.ExecNonQueryBatch("SQLCipher1")
Wait For (SenderFilter) SQLCipher1_NonQueryComplete (Success As Boolean)
Although I would still love to figure out how to transfer tables between unencrypted database and encrypted one, I did find an alternative solution. Using DBBrowser for SqlLite and B4a bridge ftp, I was able to copy my populated tables to my computer, encrypt them by adding a password and copy them back to the device. Thanks for your help and if you can post a code example to transfer tables on the device mentioned above, that would be great.