We can't see your
connection_open
method, but it's not opening the connection you are using, and you shouldn't do it like that anyway. Create your connection inside a
Using
block, open it, and let the system Close and Dispose it when it goes out of scope. "Sharing" a connection is generally a bad idea and leads to problems later.
Using con As New SqlConnection(strConnect)
con.Open()
Using cmd As New SqlCommand("SELECT iD, description FROM myTable", con)
Using reader As SqlDataReader = cmd.ExecuteReader()
While reader.Read()
Dim id__1 As Integer = CInt(reader("iD"))
Dim desc As String = DirectCast(reader("description"), String)
Console.WriteLine("ID: {0}" & vbLf & " {1}", iD, desc)
End While
End Using
End Using
End Using