I have a code in C# that should update a column form my table. Table is `accounts`, row is `totalsimyes` and new value that should be inserted in column is `totalsimda`.
I don't receive any errors, but when I get in this code at runtime, it just locks and I get do anything.
Code:
string updatecorect = "select totalsimyes from accounts where username = 'DPaul'";
SQLiteCommand updatec = new SQLiteCommand(updatecorect, Conexiune.getConnection());
SQLiteDataReader upd = updatec.ExecuteReader();
while(upd.Read())
{
int totalsimda = (Int32)upd["totalsimyes"];
totalsimda++;
using (SQLiteCommand update = new SQLiteCommand("update accounts set totalsimyes=@totalsimda where username='DPaul'", Conexiune.getConnection()))
{
update.Parameters.AddWithValue("@totalsimda", totalsimda);
int rows = update.ExecuteNonQuery();
}
}
I don't receive any errors, but when I get in this code at runtime, it just locks and I get do anything.