>Imports System.Data.SqlClient > >Public Class SQLDataReader > > Public Sub ReadMyData() > > Dim myConnString As String = "data source=(local);" & _ > "initial catalog=Northwind;" & _ > "user id=myuserid;" & _ > "password=mypassword" > > Dim mySelectQuery As String = "SELECT OrderID, CustomerID FROM Orders" > Dim myConnection As New SqlConnection(myConnString) > Dim myCommand As New SqlCommand(mySelectQuery, myConnection) > > myConnection.Open() > > Dim myReader As SQLDataReader > myReader = myCommand.ExecuteReader() <====== ERROR IS HERE > > ' Always call Read before accessing data. > While myReader.Read() > Console.WriteLine((myReader.GetInt32(0) & ", " & myReader.GetString(1))) > End While > > ' Always call Close when done reading. > myReader.Close() > > ' Close the connection when done with it. > myConnection.Close() > > End Sub 'ReadMyData > >End Class > >Kevin,