Click here to Skip to main content
15,885,980 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi,
i use this code to loop in gridview and insert the rows data into MySQL DB ,

 for (int ItemIndex = 0; ItemIndex < gridView1.DataRowCount; ++ItemIndex)
                {

}


but the last row didn't saved!

What I have tried:

i tried to use Foreach but i think Devexpress use only this syntax to iterate through all rows
Posted
Updated 26-Jul-19 20:54pm
Comments
Richard MacCutchan 26-Jul-19 11:18am    
Some part of the code that you have not not shown us is probably not working.

You could try Data Binding, if your MySQL driver allows it, see answers here: How load Mysql table to DATAGRIDVIEW of C#[^]

For more advanced purposes read: A Detailed Data Binding Tutorial[^]
 
Share this answer
 
Set a breakpoint in your loop and check the values of ItemIndex.
I expect that you will see that all your gridview rows are being addressed and your problem is in your code which you didn't show (as already suspected by Richard MacCutchan).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900