InvalidOperationException:由于对象的当前状态,操作无效 [英] InvalidOperationException: Operation is not valid due to the current state of the object

查看:68
本文介绍了InvalidOperationException:由于对象的当前状态,操作无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在显示oracle数据读取器的数据时,请帮助我们解决以下问题-2个参考游标设置了oracle存储过程的输出.

Please help us with the following issue while displaying the data of a oracle data reader - 2 reference cursors set output from a oracle stored procedure.

 

ODP.NET-使用字段时出错

      如果是(objRsA.NextResult()),则成功表示存在下一个结果集
          如果为objRsA.HasRows,则'下一个结果集具有行
 
                            当objRsA.Read()读为true时表示它具有数据并且连接已打开

                   如果objRsA.IsDBNull(objRsA("name"))然后-ERRORRRRRRRRRRRRRRRRRR
               b curContName ="空"
                   如果结束
                   
                            循环
                                      如果结束
       如果结束
       
-System.InvalidOperationException:由于对象的当前状态,操作无效.


[InvalidOperationException:由于对象的当前状态,操作无效.]
   Oracle.DataAccess.Client.OracleDataReader.IsDBNull(Int32 i)+221
   Oracle.DataAccess.Client.OracleDataReader.GetValue(Int32 i)+277
   Oracle.DataAccess.Client.OracleDataReader.get_Item(Int32 i)+39
   Oracle.DataAccess.Client.OracleDataReader.get_Item(String columnName)+59

ODP.NET - Error while using a field

        If (objRsA.NextResult()) Then 'Success means next result set is there
            If objRsA.HasRows Then 'Next result set has rows
 
                Do While objRsA.Read() ' read true means it has data and connection is open

                    If objRsA.IsDBNull(objRsA("name")) Then - ERRORRRRRRRRRRRRRRRR
                        curContName = " Null "
                    End If
                   
                loop
             end if
         end if
        
- System.InvalidOperationException: Operation is not valid due to the current state of the object.


[InvalidOperationException: Operation is not valid due to the current state of the object.]
   Oracle.DataAccess.Client.OracleDataReader.IsDBNull(Int32 i) +221
   Oracle.DataAccess.Client.OracleDataReader.GetValue(Int32 i) +277
   Oracle.DataAccess.Client.OracleDataReader.get_Item(Int32 i) +39
   Oracle.DataAccess.Client.OracleDataReader.get_Item(String columnName) +59

 

此方法或替代方法有解决方案吗?谢谢.

Is there any solution for this or alternate method? Thanks.

推荐答案

您好,srini,

Hi srini,

从错误消息可以看出IsDBNull()应该接收Interger作为其参数.因此,objRsA("name")的返回数据类型是什么?是Interger吗?另一方面,我认为如果您将其发布在 Oracle 论坛.

From the error message can tell that IsDBNull() should receive Interger as its parameter. So, what is the return data type of objRsA("name")? Is it Interger? On the other hand, I think you will probably get more efficient responses if you post it in Oracle forum.

 

最好的问候


这篇关于InvalidOperationException:由于对象的当前状态,操作无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆