I am getting the above error when I run my code. I think this is because the DataReader is Read-Only and therefore unable to amend the value.
As a new user still getting to grips with vb.Net coming from php/mysql background, can someone show me the correct way to code this please or offer an alternative method. Many thanks
As a new user still getting to grips with vb.Net coming from php/mysql background, can someone show me the correct way to code this please or offer an alternative method. Many thanks
Code:
While dr.Read()
If dr.HasRows Then
lvRequests.Items.Add((dr(0)).ToString()).UseItemStyleForSubItems = False
lvRequests.Items(lvRequests.Items.Count - 1).SubItems.Add(CDate(dr(5)).ToShortDateString())
lvRequests.Items(lvRequests.Items.Count - 1).SubItems.Add(dr(1).ToString())
With lvRequests.Items(lvRequests.Items.Count - 1).SubItems.Add(dr(3).ToString())
If dr(3) Is "D" Then
dr(3) = "destroyed" <--- ERROR
ElseIf dr(3) Is "O" Then
dr(3) = "out" <--- ERROR
End If
End With
lvRequests.Items(lvRequests.Items.Count - 1).SubItems.Add(dr(9).ToString())
lvcount += 1
End If
End While