Title: DataAccess_ADO_Oracle_Cursor

Hi again,

I am using IBATIS DataAccess dao infrastructure only not data-mapper.
Using Oracle. I am using ADO implementation. I want to retrieve multiple data i.e. cursor
And then get a dataset or else and then make a arraylist/ilist of the business entity myself.

I am doing it all like (VB Dotnet):-

SAMPLE:
1)
                        Dim command As IDbCommand
                        command = Me.GetContext().CreateCommand(CommandType.StoredProcedure)
                        command.CommandText = StoredProcedureName.SP_GETAPPLICATIONUSER
                        AddInputParameter(command, VAR_USERID, strUserId)
                        AddInputParameter(command, VAR_PASSWORD, strPassword)
                        AddOutputParameter(command, VAR_USERNAME, DbType.AnsiString, 100)
                        AddOutputParameter(command, VAR_SUCCESS, DbType.AnsiString, 100)
                        command.ExecuteNonQuery()
                        strSuccess = command.Parameters.Item(VAR_SUCCESS).Value
                        If strSuccess <> RETURNED_FAILED Then
                                strUserName = command.Parameters.Item(VAR_USERNAME).Value
                        Else
                                Return Nothing
                        End If
2)
Public Shared Sub AddInputParameter(ByVal command As IDbCommand, ByVal paramName As String, ByVal paramValue As String)
                Dim dbParam As IDbDataParameter
                dbParam = command.CreateParameter()
                dbParam.ParameterName = paramName
                dbParam.Value = IIf(paramValue.Equals(String.Empty), DBNull.Value, paramValue)
                dbParam.Direction = ParameterDirection.Input
                command.Parameters.Add(dbParam)
        End Sub

        Public Shared Sub AddOutputParameter(ByVal command As IDbCommand, ByVal paramName As String, ByVal paramType As String, ByVal paramSize As Integer)

                Dim dbParam As IDbDataParameter
                dbParam = command.CreateParameter()
                dbParam.ParameterName = paramName
                dbParam.DbType = paramType
                dbParam.Size = paramSize
                dbParam.Direction = ParameterDirection.Output
                command.Parameters.Add(dbParam)
        End Sub

3)
NOW, Problem.

Public Function GetDocumentInfo(ByVal intDocumentId As Integer) As BusinessEntities.Document Implements Interfaces.IDocumentDao.GetDocumentInfo

                Try
                        Dim strDocumentId As String = intDocumentId

                        Dim command As IDbCommand
                        command = Me.GetContext().CreateCommand(CommandType.StoredProcedure)
                        command.CommandText = StoredProcedureName.SP_GETEBI_DOCUMENT
                        AddInputParameter(command, VAR_DOCUMENTID, strDocumentId)
                        AddOutputParameter(command, VAR_ARG_RS, DbType.CURSOR) '!!! Cursor , ITS NOT THERE
                        'AddOutputParameter(command, VAR_ARG_RS, , 100)
                     'THEN I WILL DO SOMEHITNG LIKE THIS
                        ...objDataAdapter = New DataAdapter(command)
                     objDataSet = New DataSet
                     objDataAdapter.Fill(objDataSet)
                     'THEN I WILL FILL ARRAYLIST WITH BUSINESS ENTITES.
                     'BUT I M STUCK WITH CURSOR.
                     'HELP ME ASAP PLEASE.
                Catch ex As Exception
                        Throw ex
                End Try



Habib Ahmed Qureshi
Software Engineer
Mob: 00971503966137

Reply via email to