Asp.net mvc 4 由于StoredProcess中MVC4中对象的当前状态,操作无效
我收到一个错误[System.InvalidOperationException]={由于对象的当前状态,操作无效。} 通过执行StoredProcedure,我得到了一个包含数据类型OracleCLOB的值列表 这是我的密码Asp.net mvc 4 由于StoredProcess中MVC4中对象的当前状态,操作无效,asp.net-mvc-4,stored-procedures,plsql,oracle-sqldeveloper,Asp.net Mvc 4,Stored Procedures,Plsql,Oracle Sqldeveloper,我收到一个错误[System.InvalidOperationException]={由于对象的当前状态,操作无效。} 通过执行StoredProcedure,我得到了一个包含数据类型OracleCLOB的值列表 这是我的密码 try { string connectionStrings = ConfigurationManager.ConnectionStrings["OracleConnection"].ConnectionString;
try
{
string connectionStrings = ConfigurationManager.ConnectionStrings["OracleConnection"].ConnectionString;
OracleConnection con = new OracleConnection(connectionStrings);
con.Open();
OracleCommand command = new OracleCommand();
command.CommandType = System.Data.CommandType.StoredProcedure;
command.CommandText = "Pkg_RTMI_WEB.PRC_GET_RTMI_SIGNATURE";
command.Parameters.Add("P_MASAG", OracleDbType.Varchar2).Direction =
System.Data.ParameterDirection.Input;
command.Parameters["P_MASAG"].Value = MASAGR_ID;
command.Parameters.Add("P_SIG", OracleDbType.RefCursor).Direction = System.Data.ParameterDirection.Output;
OracleDataReader dr = command.ExecuteReader();
con.Close();
OracleClob clob = null;
while(dr.Read())
{
clob = dr.GetOracleClob(0);
}
return clob;
}
catch (Exception ex)
{
/// Exception Block
BaseObject.IsSuccessful = false;
BaseObject.Message = "[RTMISignature]: " + ex.Message;
return null;
}
此行中出现错误OracleDataReader dr=command.ExecuteReader
还将此行添加到Web.Config
但同样的结果
注意:CLOB包含超过12k个字符Add命令。Connection=con@StupMueKEK感谢FordEdvor,但是您确实应该考虑使用连接和Data Reader的语句。
<appSettings>
<add key="aspnet:MaxHttpCollectionKeys" value="15000" />
</appSettings>