The flow of my app is as follows
1) Pull up an order and change the quantity of a textbox item. (Ex: change the quantity from 1 to 2
2) Click on the Update button
3) When the page posts back you should see the updated quantity of the item. (by the way, in some cases there will be multiple lines for an order...this is where the problem comes in.
What happens is that the process works...for the first row of data only. I need the app to update all lines of an order, not just the first line. Below is the problematic code
//Code Star
for(int counter = 0; counter < tbl.Rows.Count; counter++) //I have verified that the count of table rows is correct, no matter the amount...so the issue is not with the row coun
objCommand.CommandText = "update_qp"; //this is the stored procedure which is a simple update statement. there is nothing to it
objCommand.CommandType = CommandType.StoredProcedure
objCommand.Parameters.Clear(); //I clear the parameters just in case
objCommand.Parameters.Add("@Quantity", tbl.Rows[counter]["Quantity"]); //if you set the counter variable to 1 it will update the second order line correctly, if you set the counter variable to 2 it will update the third order line correctly, etc. this is good because it shows that the data is there and it is correct. However, by default (i.e. leave it set to tbl.Rows[counter]) it will only display the first row (i.e. tbl.Rows[0]) , even though this code is contained within a looping structure
objAdapter.UpdateCommand = objCommand
objAdapter.Update(tbl)
//Code En
Does anyone know what is going on? The data is all there, it recognizes how many rows the table has, and it updates perfectly if you hardcode the row numbers. So why won't this work by looping through? Does it have something to do with the objAdapter.Update?