简体   繁体   中英

how to get dataset value from store procedure for oracle in c#

my sp returning table in curser but im getting error while mapping with dataset

DataSet ds = new DataSet();

command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("Size", OracleDbType.Int16).Value = size
command.Parameters.Add("Index", OracleDbType.Int16).Value = Index;
command.Parameters.Add("Data", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

OracleDataAdapter da = new OracleDataAdapter(command);
da.Fill(ds);
return ds;

But I am getting below error:
How to map it

[InvalidOperationException: Operation is not valid due to the current state of the object.] System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e) +130 System.Web.UI.Page.RaiseChangedEvents() +105 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3572

[InvalidOperationException: Operation is not valid due to the current state of the object.]

There are multiple possibilities for this exception.

1) command.CommandText = *Your Sp's name will go here*; Looks like missing in your code. Give CommandText if missing.

2) In may be because of MaxHttpCollection setting in web.config. By default it can hold 1000. Add following setting in your web.config.

<appSettings>
    <add key="aspnet:MaxHttpCollectionKeys" value="2001" />
</appSettings> 

Hope this will solve your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM