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

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

问题描述

由于对象的当前状态,我有一个错误操作无效
我有以下解决方案
< appsettings>
< add key ="aspnet:MaxHttpCollectionKeys" value ="2001">

但这仅适用于600条记录,但我在grid.中有5000条记录.那么5000条记录的正确值是什么
请帮助我

i have a error operation is not valid due to current state of object
i have the below solution
<appsettings>
<add key="aspnet:MaxHttpCollectionKeys" value="2001">

but this is valid for only 600 hundred records but i have 5000 records in grid.so what will be the right values for 5000 records
please help me

推荐答案

亲爱的朋友,

由于我不知道您正在使用哪个数据库语句从表中读取数据,因此假设您使用的是数据读取器:-

通常,当您的SQL语句不返回任何值,阅读器没有任何内容时,就会发生这种情况.这也可以解释为什么有时会起作用,而其他时候不会起作用.

数据读取器需要开放的连接,因为它适用于连接的体系结构.请检查连接是否已打开.如果您尝试读取的行被某个其他事务锁定,我想oracle可能会抛出此错误,请检查您是否无法使用select语句给出锁定提示.

我建议您使用断开连接的体系结构,使用数据集.这很容易和简单.它减少了数据库服务器上的负载.它获取数据并自动关闭连接.在连接的体系结构中,即数据读取器,连接必须保持打开状态,直到完成所有业务逻辑为止.
Dear Friend,

As i don''t know what database statement you are using to read the data from the table, so assuming that you are using a data reader:-

Generally this occurs when your SQL statement returns no values, the reader has nothing to read. Which would also explain why it works sometimes, and it doesn''t work other times.

Data reader requires an open connection since it works on connected architecture.check if the connection is opened. If the rows u r trying to read is locked by some other transaction, i guess oracle might throw this error, Check if u can give no lock hint with select statement.

I would suggest u to use disconnected architecture, usage of datasets. It is easy and simple. It reduces the load on database server. It gets the data and closes the connection automatically. In connected architecture i.e data reader the connection has to be remained open till all ur business logic is completed.


请点击以下链接

错误-由于当前原因操作无效对象的状态. [ ^ ]
Hi, follow below link

Error - Operation is not valid due to the current state of the object.[^]


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

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