System.InvalidOperationException: Operation is not valid due to the current
state of the object.
I'm getting this error when I'm trying to read() from the OracleDataReader.
The reader and connection are both open, so I don't understand why I'm
getting this error.
Using: Windows 2003 Server, ODP .NET 9.2.4.0, .NET Frameworks 1.1
string groupid = "";
string fullname = "";
string ConnectString = ConfigurationSettings.AppSettings["ConnectString"];
OracleConnection dbconn = new OracleConnection(ConnectString);
OracleCommand cmd = new OracleCommand("userdetails_pkg.userdetails",dbconn);
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter param = new
OracleParameter("c_UserDetails",OracleDbType.RefCursor);
cmd.Connection = dbconn;
cmd.Parameters.Add(new
OracleParameter("p_UserName",OracleDbType.Varchar2)).Value = usr;
cmd.Parameters.Add(param).Direction = ParameterDirection.Output;
try
{
dbconn.Open();
cmd.ExecuteNonQuery();
OracleRefCursor cur = (OracleRefCursor) param.Value;
OracleDataReader odr = cmd.ExecuteReader();
while ( odr.Read() );
{
// NEXT LINE IS WHERE IT ERRORS OUT!!!
groupid = odr["groupid"].ToString();
fullname = odr["fullname"].ToString();
}
odr.Close();
odr.Dispose();
}
catch (OracleException oe )
{
lblResponse.Text = "Error: " + oe.Message;
}
finally
{
cmd.Dispose();
dbconn.Dispose();
}
--dweezil
Are you using ADSI or System.DirectoryServies in your application?
--
Val Mazur
Microsoft MVP
"dweezil" <dwe...@discussions.microsoft.com> wrote in message
news:20E18A4B-4648-45D5...@microsoft.com...
This is a brand new application on a new server, and I'm not using Active
Directory, I am using Forms Authenication though.
I belive that this is caused by not opening the ref cursor in the procedure.
create procedure foo(out_rc sysrefcursor)
is
begin
open out_rc for
select * from dual;
end;
Is there some path in your procedure where the ref cursor is not opened?
David
I believe it could be security issue from the provider, but I cannot try it
here, because I do not have an Oracle
--
Val Mazur
Microsoft MVP
"dweezil" <dwe...@discussions.microsoft.com> wrote in message
news:DA312E8E-A999-475E...@microsoft.com...