I have a gridview which when I upload my data and make an attempt to submit it to mysql database I get his error
“error=Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index””
Here is the code I am using, and the problem occurs on the address row.
For i = 0 To GridView1.Rows.Count - 1
Using sqlCommand As New MySqlCommand()
student_id = GridView1.Rows(0).Cells(i).Text.ToString
age = GridView1.Rows(1).Cells(i).Text.ToString
adress = GridView1.Rows(2).Cells(i).Text.ToString
Something seems wrong here.
You loop over the rows of the gridview, but then you take the index of the row to access the cells.
Probably you want this