I’m new to ADO.net and I learned how to get stuff into data grid views and how to use Insert/Delete commands. However, I would like to take a cell from the database and turn it into an integer or any type of variable for that matter. for example,
da.UpdateCommand = new OleDbCommand("UPDATE tbl_Inventory SET 'InOrder = @InOrder', 'OutOrder = @OutOrder' WHERE ItemNum = '@ItemNum'", cs);
da is my data adapter and I want to update this table. i have a txt_units box and I want to update the InOrder by adding that to the txt_units. I could set a paramater (da.UpdateCommand.Parameter.Add … etc) to set it to that certain number but first I want to extract the information from tbl_Inventory so I can subtract the value off.
If this is not clear, I can explain my question better… Thanks for your help!
additional specs … using access database, oledb connection, visual studio 2010, windows form
If I understand correctly you want to add the value from the text box (units) to current value in the database?
If so then an update statement along the following lines should work:
Where @Units is a integer parameter that you use to specify the value from the text box. I’m not sure what you were doing with OutOrder so I’ve left it out (-: