473,397 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

I don't understand this error.

I have a method that queries a database table, to retrieve possible
format codes. The method is as follows:

public ArrayList GetDate(string frameSize, string partType)
{
ArrayList alAllFormats = new ArrayList();
ArrayList alDisplayFormats = new ArrayList();

OracleCommand cmdHeatCastDate = new OracleCommand("SELECT
DATE_FORMAT, "
+ "DISPLAY_TO_USER FROM DBO.CAST_INFO WHERE FRAME_SIZE='"
+ frameSize + "' AND PART_TYPE='" + partType + "'",
connMachinePartDatabase);

OpenConnection();

OracleDataReader rdrQuery;

try
{
rdrQuery = cmdHeatCastDate.ExecuteReader();

while(rdrQuery.Read())
{
try
{
if(rdrQuery.GetString(1)=="YES")
{
alAllFormats.Add(rdrQuery.GetString(0));
alDisplayFormats.Add(rdrQuery.GetString(0));
}
else
{
alAllFormats.Add(rdrQuery.GetString(0));
}
}
catch(System.InvalidCastException)
{
alAllFormats.Add("");
}
}

ArrayList heatCastDateInfo = new ArrayList();
heatCastDateInfo.Add(alDisplayFormats);
heatCastDateInfo.Add(alAllFormats);

return heatCastDateInfo;
}
catch(Exception EX)
{
throw new DataFormatException();
}
finally
{
rdrQuery.Close();

connMachinePartDatabase.Close();
}
}

My problem is that while testing/debugging, I keep getting the
following error:
{"Operation is not valid due to the current state of the object."
}

and I cannot figure out why. If I don't step through the code, then it
loads the information fine. Can anyone help me with the issue? Your
help is greatly appreciated.

Apr 21 '06 #1
1 3119
http://www.derkeiler.com/Newsgroups/...4-10/0031.html

http://groups.google.com/group/micro...d94c88efe05daf
http://groups.google.com/group/micro...726dbf0ad10164
"eric" <er**********@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
I have a method that queries a database table, to retrieve possible
format codes. The method is as follows:

public ArrayList GetDate(string frameSize, string partType)
{
ArrayList alAllFormats = new ArrayList();
ArrayList alDisplayFormats = new ArrayList();

OracleCommand cmdHeatCastDate = new OracleCommand("SELECT
DATE_FORMAT, "
+ "DISPLAY_TO_USER FROM DBO.CAST_INFO WHERE FRAME_SIZE='"
+ frameSize + "' AND PART_TYPE='" + partType + "'",
connMachinePartDatabase);

OpenConnection();

OracleDataReader rdrQuery;

try
{
rdrQuery = cmdHeatCastDate.ExecuteReader();

while(rdrQuery.Read())
{
try
{
if(rdrQuery.GetString(1)=="YES")
{
alAllFormats.Add(rdrQuery.GetString(0));
alDisplayFormats.Add(rdrQuery.GetString(0));
}
else
{
alAllFormats.Add(rdrQuery.GetString(0));
}
}
catch(System.InvalidCastException)
{
alAllFormats.Add("");
}
}

ArrayList heatCastDateInfo = new ArrayList();
heatCastDateInfo.Add(alDisplayFormats);
heatCastDateInfo.Add(alAllFormats);

return heatCastDateInfo;
}
catch(Exception EX)
{
throw new DataFormatException();
}
finally
{
rdrQuery.Close();

connMachinePartDatabase.Close();
}
}

My problem is that while testing/debugging, I keep getting the
following error:
{"Operation is not valid due to the current state of the object."
}

and I cannot figure out why. If I don't step through the code, then it
loads the information fine. Can anyone help me with the issue? Your
help is greatly appreciated.

Apr 22 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Tobias Langner | last post by:
compiling this line: SmartPtr<LongWrapper, RefCount> p1=SmartPtr<LongWrapper, RefCount>(new LongWrapper(1)); with SmartPtr being: template <class T, template <class> class OwnershipPolicy>...
20
by: Sam | last post by:
Hi I'm learning to code with C++ and wrote some very simple code. I think it's consistent with every rule but always got compiling errors that I don't understand. The code include 5 files as...
16
by: Jace Benson | last post by:
Ok I have read alot of things on zend.com, php.net and other sites went to the wikibooks to try to understand how to use a class. I have this project I want to do that I am sure would work great...
8
by: Joshua Moore | last post by:
/* Hi, I was hoping someone could help me with this problem. I did my work and worked my way through the usual compiler messages, but I have run against some problem I can't identify. The compiler...
31
by: Jo | last post by:
class A { public: char text_a; A() { *text_a=0; } ~A() {} }; //-----------------------------------------------------------------------------
38
by: Jonathan Wood | last post by:
The following code raises the error "Specified cast is not valid." MembershipUser user = Membership.GetUser(userId); DataSet ds = DataLayer.ExecQueryData("SELECT * FROM mc_Clients WHERE...
3
by: Ben Thomas | last post by:
Hello, I have the following code which I don't understand why it works : #include <iostream> using namespace std; void DontWork (unsigned int& i) { cout << i << endl; }
0
by: Stef Mientki | last post by:
hello, I've syntax error which I totally don't understand: ########## mainfile : import test_upframe2 if __name__ == '__main__': var1 = 33 code = 'print var1 + 3 \n'
0
by: Stef Mientki | last post by:
Terry Reedy wrote: sorry, don't know how this happened, as I always copy/paste ? AFAIK locals() == sys._getframe(0).f_locals AFAIK, again one level up weird, I use it in 2.5 and if I remember...
5
by: Thierry | last post by:
Hello fellow pythonists, I'm a relatively new python developer, and I try to adjust my understanding about "how things works" to python, but I have hit a block, that I cannot understand. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.