Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How do you use in C# an Oracle ODP.net ExecuteReader with SP that return

user5203716Feb 7 2012 — edited Feb 29 2012
I have a procedure that returns a ref cursor. It takes 4 parameters am using C#. I have looked for examples all over the net but can't get any of them to work. Using 10gr2 on unix with C# 4.0

this is what i have

public static int test(int test_id, int progr, int setID, string BFilter)
{
object cur1 = System.DBNull.Value;
string spname = "SP.GetValues";

using (Oracle.DataAccess.Client.OracleCommand command = DB.GetStoredProcCommand(spname, test_id, progr, setID, BFilter, cur1))
{
using (OracleDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
//load array
}
}
}

}

error i get when it runs is : Operation is not valid due to the current state of the object.

I was using a Dataset which worked fine except it was taking 20 secs everytime to get 500 rows and i have to do that 800 times. i though using a datareader, loading the data it returns into an array then looping over the array would be faster than reading into a dataset. The SP itself takes 1 sec to return, it spends 19 secs in the fill line.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 28 2012
Added on Feb 7 2012
3 comments
3,298 views