Public Sub ReadMyData(ByVal myConnString As String)
Dim myConnection As New OracleConnection(myConnString)
Dim myCommand As OracleCommand = myConnection.CreateCommand()
myCommand.CommandText = "SELECT DeptNo, DName, Loc FROM Test.Dept"
myConnection.Open()
Dim myReader As OracleDataReader = myCommand.ExecuteReader()
Try
' Always call Read before accessing data.
While myReader.Read()
Console.WriteLine(String.Concat(myReader.GetInt32(0).ToString(), " ", _
myReader.GetString(1), " ", myReader.GetString(2)))
End While
Finally
' always call Close when done reading.
myReader.Close()
' Close the connection when done with it.
myConnection.Close()
End Try
End Sub