How can I get MS-Access data in the array?
I tried this:
Dim i As Integer = 0
Dim farmers() As String = {}
sql = "SELECT * FROM users"
cmd = New OleDbCommand(sql, connection)
reader = cmd.ExecuteReader()
If Not reader.HasRows Then
'nothing
ElseIf reader.HasRows Then
Do While reader.Read
farmers(i) = CStr(reader.Item(1))
i += 1
Loop
End If
For Each element As String In farmers
MsgBox(element)
Next
It shows an error:
My MS-Access Database table is:
users
____________________________
| ID | Number | Name |
| 1 | 10 | John |
| 2 | 15 | Joe |
| 3 | 7 | User3 |
and I want those 10 15 7 in array.
How can I get that? Or any other methods?
Any help is appreciated. Thank You
