patrickstrijdonck
Programmer
Hello,
Im trying to update a record with a new value,
short explanation: Ive got a table tblItems, which contains all my items which are on stock. when i send 1 product, the amount must decrease by the amount im sending in the transaction.
this part is working, ive made a textbox visible on the form where i can see what the amount is after the transaction. in table, amount is 2, im sending 1 and the textbox shows, 1 so thats OK
now i want to update the table and update the value with the value thats currently in the textbox.
Textbox 1 contains the productnumber
Textbox 9 contains the new value.
when i try a transaction there is NO error, BUT the new value is not updated in the table, it remains on 2 (if it was 2)
I placed a messagebox in the code to see if the code is really executed, the message shows so the code is executed.
ive tried alot of things to get the table to update, but it just wont!
Am i missing something???
Im trying to update a record with a new value,
short explanation: Ive got a table tblItems, which contains all my items which are on stock. when i send 1 product, the amount must decrease by the amount im sending in the transaction.
this part is working, ive made a textbox visible on the form where i can see what the amount is after the transaction. in table, amount is 2, im sending 1 and the textbox shows, 1 so thats OK
now i want to update the table and update the value with the value thats currently in the textbox.
Code:
string connstrr = Properties.Settings.Default.IT4STOCKConnectionString;
string cmddstrr = "UPDATE tblItems SET AantalDC = aantal WHERE Productnr = productnumber";
OleDbConnection connr = new OleDbConnection(connstrr);
OleDbCommand commr = new OleDbCommand(cmddstrr, connr);
connr.Open();
commr.Parameters.AddWithValue("productnumber", textBox1.Text);
commr.Parameters.AddWithValue("aantal", textBox9.Text);
commr.ExecuteNonQuery();
connr.Close();
Textbox 9 contains the new value.
when i try a transaction there is NO error, BUT the new value is not updated in the table, it remains on 2 (if it was 2)
I placed a messagebox in the code to see if the code is really executed, the message shows so the code is executed.
ive tried alot of things to get the table to update, but it just wont!
Am i missing something???