OracleRefCursor error, cannot transform into oracledatareader using ODPNet DAAB

Topics: Development Team Discussion, User Discussion
Mar 4, 2010 at 1:29 PM
Edited Mar 4, 2010 at 2:26 PM

I am trying to call an oracle stored procedure and am using the EL DAAB, the procedure takes in a couple of varchar2 values and returns one refcursor.

 

 I am using the Enterprise Library DAAB for ODPNet -EntLibContrib.Data.OdpNet.dll assembly version 4.1.0.0.

Code:

Public Class DBAccess

Dim ds As New DataSet()

Dim dr As System.Data.IDataReader

Private dBConnection As String = NCCIConfig.GetConnectString("MDC")

Private db As New EntLibContrib.Data.OdpNet.OracleDatabase(dBConnection)

Private transaction As Common.DbTransaction Dim parameters(0) As Object

Private connection As OracleConnection

Public Function execSprocDRCursor(ByVal sprocName As String, ByVal cmdparameters As Object) As System.Data.IDataReader

Dim cw As System.Data.Common.DbCommand

Dim parameters(UBound(CType(cmdparameters, Array))) As Object

Dim dr2 As Oracle.DataAccess.Client.OracleDataReader

parameters = CType(CType(cmdparameters, Array).Clone, Object())

cw = db.GetStoredProcCommand(sprocName, parameters)

dr2 = CType(db.ExecuteReader(cw), OracleDataReader)

execSprocDRCursor = dr2

End Function

Error/Stack Trace:

I have been getting this error Error: System.InvalidCastException Unable to cast object of type 'Oracle.DataAccess.Client.OracleDataReader' to type 'Oracle.DataAccess.Types.OracleRefCursor'. at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior) at Oracle.DataAccess.Client.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteReader(DbCommand command, CommandBehavior cmdBehavior) at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader(DbCommand command) at EntLibContrib.Data.OdpNet.OracleDatabase.ExecuteReader(DbCommand command) at Data.DBAccess.execSprocDRCursor(String sprocName, Object cmdparameters) in C:\Data Services\External\DFR\Data\Common\DBAccess.vb:line 55 at NCCI.DFR.UnitCustomReportRequest.GetQualityTrackingByGrp(String groupID, String rptYr, String rptQrtr, String sbmsnTypeCd) in C:\Data Services\External\DFR\DFR\CustomReport\UnitCustomReportRequest.aspx.vb:line 521 at NCCI.DFR.UnitCustomReportRequest.Page_Load(Object sender, EventArgs e) in C:\Data Services\External\DFR\DFR\CustomReport\UnitCustomReportRequest.aspx.vb:line 11 at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Feb 8, 2012 at 9:28 AM

any solution about it ?