I was trying to update the ProductQty column at a specific row in the ProductDB table but somehow no changes were made after execution.
For instance, at ID 1, the column of ProductQty is set to 30. I wanted to amend it to 29, but even after execution, the table remains unchanged.
OleDbConnection connect =
new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=POSDB.accdb;
Persist Security Info = False");
connect.Open();
string query = "UPDATE ProductDB SET [ProductQty] = @quandiff WHERE [ID] = @id";
OleDbCommand command = new OleDbCommand(query, connect);
command.Parameters.AddWithValue("@quandiff", quanDiff);
command.Parameters.AddWithValue("@id", location);
command.ExecuteNonQuery();
I tested the quanDiff and location variables beforehand via Console.Write and the data was retrieved alright. Just couldn't get the query working for whatever reason.
Unless I have done something wrong here, if you can point it out.