Click here to Skip to main content
15,917,645 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am trying to create a reader from the given parameter object while trying to parse the 'ref cursor' output to property object in C#. _getDataReaderMethod as below becomes null and could't proceed.

Input: command.Parameters[readerCursorName] sent as dbParameter to GetDataReader method

private static MethodInfo _getDataReaderMethod;
...
...
public DbDataReader GetDataReader(DbParameter dbParameter)
...
...
// Get the value for the parameter ie the ref cursor
object refCursor = dbParameter.Value;
_getDataReaderMethod = refCursor.GetType().GetMethod("GetDataReader");


_getDataReaderMethod becomes 'null' and couldn't proceed further to return the DbDataReader.

returnValue = _getDataReaderMethod.Invoke(dbParameter.Value, null);


Note: An inner exception says 'base {System.SystemException} = {"Method may only be called on a Type for which Type.IsGenericParameter is true."}'

Any suggestions please. Thanks in advance.
Posted

1 solution

I spent many hours on it, finally found the root cause myself,

OracleCommand oracleCommand = command as OracleCommand;
oracleCommand.ArrayBindCount = some_collection_object.Count;


Since I had enabled the array binding to the input parameters, the output ref_cursor also had become array type which caused this problem.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900