由于对象的当前状态而导致无效的操作 [英] Invalid Operation due to current state of object

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

问题描述

我得到一个错误:由于对象的当前状态而导致的无效操作在执行以下代码时:

I am getting an error: Invalid operation due to current state of object when executing following piece of code:

dim cmd as oracleCommand= New oraclecommand("Select * from table1")
dim dr as oracleDataReader = cmd.ExecuteReader()


Cmd.ExecuteReader()
行上生成错误
对于ConnectionString,我使用以下构造函数:


Error generate on the line Cmd.ExecuteReader()

For ConnectionString i used the following constructor:

Public Sub New(ByVal m_conERP As Oracle.DataAccess.Client.OracleConnection, _
   ByVal m_objUser As ERPCommon.User, ByVal m_selectedMenu As ERPCommon.User.Menu)
       Me.New()
       Try
           conERP = m_conERP
           objUser = m_objUser
           selectedMenu = m_selectedMenu
           'StartUp()
       Catch ex As Exception
       End Try
   End Sub

推荐答案

dim dr as New oracleDataReader = cmd.ExecuteReader()


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

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