Whenever I call the test() method the code runs until it reaches the Messagebox.show() When i try to insert into the "vandute" table i get the error "DATABASE IS LOCKED"
private void test()
{
int z;
SQLiteConnection dbcon = new SQLiteConnection("Data Source=stefanauto.psa;Version=3;");
dbcon.Open();
using (SQLiteCommand sql = new SQLiteCommand(dbcon))
{
sql.CommandText = "select ID from clienti where CNP='" + cnp.Text + "'";
z = Convert.ToInt32(sql.ExecuteScalar());
MessageBox.Show(z.ToString());//The error begins after this line
sql.CommandText = "insert into vandute(ID_MASINA,ID_CLIENT)values(1,2)";//Id_MASINA,ID-CLIENT ARE integers
sql.ExecuteNonQuery();
}
}
Can you please explain me what am I doing wrong?