Answer the question
In order to leave comments, you need to log in
C#-SQLite Error: Database is locked, why?
string filename = "operapass.txt";
StreamWriter Writer = new StreamWriter(filename, false, Encoding.UTF8);
string db_way = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Opera Software\\Opera Stable\\Login Data";
string db_field = "logins";
byte[] entropy = null;
string description;
DataTable DB = new DataTable();
string sql = string.Format("SELECT * FROM {0} {1} {2}", db_field, "", "");
using (SQLiteConnection connect = new SQLiteConnection(string.Format("Data Source={0};", db_way)))
{
SQLiteCommand command = new SQLiteCommand(sql, connect);
SQLiteDataAdapter adapter = new SQLiteDataAdapter(command);
adapter.Fill(DB);
int rows = DB.Rows.Count;
for (int i = 0; i < rows; i++)
{
Writer.Write(i + "{" + Environment.NewLine);
Writer.Write("\turl : " + DB.Rows[i][1] + Environment.NewLine);
Writer.Write("\tlogin : " + DB.Rows[i][3] + Environment.NewLine);
byte[] byteArray = (byte[])DB.Rows[i][5];
byte[] decrypted = DPAPI.Decrypt(byteArray, entropy, out description);
string password = new UTF8Encoding(true).GetString(decrypted);
Writer.Write("\tpassword: " + password + Environment.NewLine + "}" + Environment.NewLine + Environment.NewLine);
listBox1.Items.Add(DB.Rows[i][1]);
listBox2.Items.Add(DB.Rows[i][3]);
listBox3.Items.Add(password);
}
}
Writer.Close();
Answer the question
In order to leave comments, you need to log in
I decided by copying this file to where the program is located, and then I turn to it)
In general, the problem could be that the database was opened by its owner. Because SQLite is single-threaded, then when you open it, the process locks the database file so as not to damage the data.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question