Encrypted database from Android application using SQLCipher 4.0.1. Written a code which decrypt all database files using SQLCipher 3.5.1. Have upgraded SQLite version using “Install-Package System.Data.SQLite -Version 1.0.111”.
My code is:
string path = Path.GetDirectoryName(inputFile);
string baseFilename = Path.GetFileNameWithoutExtension(inputFile);
string outputFile = path + “\” + baseFilename;
SQLiteCommand cmd = sql.CreateCommand();
cmd.CommandText = "ATTACH DATABASE '" + outputFile + "'AS outputDB ";
cmd.CommandText += "KEY '';";
cmd.ExecuteNonQuery();
After the statement , getting below run time error:
Failed: code = NotADb (26), message = System.Data.SQLite.SQLiteException (0x800007FF): file is not a database
file is not a database
at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt)
at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)
at System.Data.SQLite.SQLiteDataReader.NextResult()
at System.Data.SQLite.SQLiteDataReader…ctor(SQLiteCommand cmd, CommandBehavior behave)
at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery(CommandBehavior behavior)
at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery()
Please help me…