adapterJobEntry.Update() does not work when move to the last selected row

I am going to update the JobHead field according to the selected row in a job list grid by JobNum. when i selected multi line, the jobHead field can be updated successfully until move to the last selected row.
I set messagebox to show if the code works, and it does show the both message of before and after. but the Jobhead field against the last selected row is not updated.

Can anybody help me to check ? I am afraid I will be crash :frowning:

Have you tried to add a row of code like this before your update?

adapterJobEntry.JobLaborData.JobHead [0 ].RowMod = “U”;

Thanks, Knash.

I tried but it is still not be updated.
image
I checked the Job Entry. It is 0 which is the value before update instead of 50.

Where are you calling this from? Is this in a dashboard? Are you sure the dashboard isn’t making the changes on it’s own? What happens if you hit “save” right after you loop through with the button?

Hi, Banderson,

Thanks for your information.
I can update all successfully except the last line selected. Fox example, I can update 4 when I selected 5 rows.The grid is customized Job Status Maintenance gridlist.

Best regards,
Leo

What I’m getting at, is I don’t think your custom code there is doing the updating. I think the screen is doing it on it’s own. Comment out the update, the and just loop through the dataview and change the values. I would bet that it saves it. The last line if you foreach loop is setting the View value to the string, then when you change rows, the screen is doing the save for you.

Thank you, Banderson. I found the issue is JobHead[0]. 0 is wrong means I always update the first row of the dataset.

Thanks for your information.