here is the code
Function getData(ByVal id As String)
Dim reader As SqlClient.SqlDataReader
Dim statement As String
Dim count As Integer
Dim temp As Integer
statement = "SELECT * FROM General WHERE accountid='" + id + "'"
Conn.Open()
Comm = New SqlClient.SqlCommand(statement, Conn)
reader = Comm.ExecuteReader()
count = reader.FieldCount
Dim Data(count) As String
If reader.HasRows Then
For temp = 0 To count
Data(temp) = (reader.Item(temp))
Next temp
Else
Console.WriteLine("No rows found.")
End If
reader.Close()
Conn.Close()
Return Data
End Function
when i run the code the hasRow feild is true but reader.Item(temp) gives error "Invalid attempt to read when no data is present."
Can someone pls help