I need to change my field QB_STATUS from value R to value C. I am doing this in a loop because i cannot "requery" the table as data may have changed.
I have built a list of entries to update. The code does not error and iterates through 5 times (correct based on my idInvoices list) but the field does not get updated.
for (int i = 0; i < idInvoices.Count; i++)
{
// following command will update one row as ID_Invoice is primary key.
// ID_Invoice taken from list previously built in ReadDataToNAVArray
SqlCommand cmd = new SqlCommand("UPDATE tblINVOICES SET QB_STATUS=@Status WHERE ID_INVOICE = @IDInvoice", myConnection);
cmd.Parameters.Add("@Status", "C");
cmd.Parameters.Add("@IDInvoice", idInvoices[i]);
cmd.Dispose();
}
cmd.ExecuteNonQuery().