Dim oracleConnection As New OracleConnection() Dim oracleCommand As New OracleCommand() Dim oracleReader As OracleDataReader Dim sqlString As String sqlString = "data source=oracle.server;user id=test;password=test"
Try oracleConnection.ConnectionString = sqlString oracleConnection.Open() oracleCommand.CommandText = "SELECT * FROM DBTEST.PEOPLE" oracleCommand.Connection = oracleConnection oracleReader = oracleCommand.ExecuteReader ' Work with oracle data oracleReader.Close() oracleCommand.Dispose()
Catch ex As OracleException 'handle the exception
Catch ex As Exception 'handle the exception
Finally If Not (oracleConnection Is Nothing) Then oracleConnection.Close() End If End Try |