Calling a Oracle Stored Procedure

Imports System.Data.OracleClient


Dim cnConnection As OracleConnection = New OracleConnection(System.Configuration.ConfigurationSettings.AppSettings("DBConnectionString"))
cnConnection.Open()
Dim cnCommand As New OracleCommand()
With cnCommand
.Connection = cnConnection
.CommandText = "SP_MY_PROCEDURE"
.CommandType = Data.CommandType.StoredProcedure
.Parameters.Add(New OracleParameter("COMPID", OracleType.Number)).Value = CompanyID
.Parameters.Add(New OracleParameter("OUT_CUR", OracleType.Cursor)).Direction = Data.ParameterDirection.Output
Dim rdrQuery As OracleDataReader
rdrQuery = cnCommand.ExecuteReader(Data.CommandBehavior.CloseConnection)
End With

1 comment: