Almost complete noob needs assistance
Posted: Fri 03 Aug 2012 17:45
Hi all,
Need a little assistance. I need to run an oracle packaged stored procedure that returns a record set. I'm not allowed onto the Oracle database, and the package has been built for me by our Oracle team.
I have a simple function that connects to the database and runs the stored proc, but it's only returning the last entry in the record set. I've been playing withe the oracle datatable, hence the dt.fill command that doesn't do anything. I KNOW this is simple, but I'm lost in the woods, and just can't see the trees any more. Any advice will be most welcome.
Here's the function:
----------------------------------------------------------------------------
Private Function GetSingleNumericParameterProcedure(ByVal ProcedureName As String, ByVal InputValue As Integer) As OracleDataSet
'Connection string needs to use a system string contained within the web.config
Dim MyConnectionString As String = GetOracleDatabaseConnectionString() ' OracleDatabaseConnectionString
Dim MyConnection As New Devart.Data.Oracle.OracleConnection
MyConnection.ConnectionString = MyConnectionString
Dim MyDataSet As New Devart.Data.Oracle.OracleDataSet 'Data.DataSet
MyConnection.Open()
'Dim MyCommand As New OracleCommand(ProcedureName, MyConnection)
Dim MyCommand As New OracleCommand
MyCommand.CommandType = System.Data.CommandType.StoredProcedure
MyCommand.CommandText = ProcedureName
MyCommand.ParameterCheck = True
MyCommand.Connection = MyConnection
Dim InputParameter As OracleParameter = MyCommand.Parameters.Add("p_input", OracleDbType.Number)
InputParameter.Direction = ParameterDirection.Input
InputParameter.Value = InputValue
Dim OutputParameter As OracleParameter = MyCommand.Parameters.Add("p_record_set", OracleDbType.Cursor)
OutputParameter.Direction = ParameterDirection.Output
Dim dt = New OracleDataTable(MyCommand, MyConnection)
dt.Fill()
Using MyAdapter As New OracleDataAdapter(MyCommand)
MyAdapter.Fill(MyDataSet)
End Using
MyConnection.Close()
MyConnection.Dispose()
Return MyDataSet
End Function
Need a little assistance. I need to run an oracle packaged stored procedure that returns a record set. I'm not allowed onto the Oracle database, and the package has been built for me by our Oracle team.
I have a simple function that connects to the database and runs the stored proc, but it's only returning the last entry in the record set. I've been playing withe the oracle datatable, hence the dt.fill command that doesn't do anything. I KNOW this is simple, but I'm lost in the woods, and just can't see the trees any more. Any advice will be most welcome.
Here's the function:
----------------------------------------------------------------------------
Private Function GetSingleNumericParameterProcedure(ByVal ProcedureName As String, ByVal InputValue As Integer) As OracleDataSet
'Connection string needs to use a system string contained within the web.config
Dim MyConnectionString As String = GetOracleDatabaseConnectionString() ' OracleDatabaseConnectionString
Dim MyConnection As New Devart.Data.Oracle.OracleConnection
MyConnection.ConnectionString = MyConnectionString
Dim MyDataSet As New Devart.Data.Oracle.OracleDataSet 'Data.DataSet
MyConnection.Open()
'Dim MyCommand As New OracleCommand(ProcedureName, MyConnection)
Dim MyCommand As New OracleCommand
MyCommand.CommandType = System.Data.CommandType.StoredProcedure
MyCommand.CommandText = ProcedureName
MyCommand.ParameterCheck = True
MyCommand.Connection = MyConnection
Dim InputParameter As OracleParameter = MyCommand.Parameters.Add("p_input", OracleDbType.Number)
InputParameter.Direction = ParameterDirection.Input
InputParameter.Value = InputValue
Dim OutputParameter As OracleParameter = MyCommand.Parameters.Add("p_record_set", OracleDbType.Cursor)
OutputParameter.Direction = ParameterDirection.Output
Dim dt = New OracleDataTable(MyCommand, MyConnection)
dt.Fill()
Using MyAdapter As New OracleDataAdapter(MyCommand)
MyAdapter.Fill(MyDataSet)
End Using
MyConnection.Close()
MyConnection.Dispose()
Return MyDataSet
End Function