I am running the following lines... - OracleConnection connection=new OracleConnection("myConnectionStringIsHere");
-
connection.Open();
-
var startValueParameter=new OracleParameter {ParameterName="@START_VALUE", Value=0};
-
var chunkSizeParameter=new OracleParameter {ParameterName="@CHUNK_SIZE", Value=10};
-
var command=new OracleCommand
-
{
-
Connection=connection,
-
CommandType=CommandType.Text
-
};
-
command.CommandText = "select EmployeeID, test_id from ExampleTable where (test_id > :START_VALUE) AND (rownum <= :CHUNK_SIZE)";
The error I get is on the very last line where I try to set command.CommandText.
System.InvalidCastException: Unable to cast object of type 'System.String' to type 'Oracle.DataAccess.Client.OracleConnection'
This is very strange, as it suddenly started happening out of the blue. Any suggestions? Thanks.
7 6950
Is the colorization of the text abnormal in your visual studio? If one of those quotes is not closed, it could be trying to interpret a whole section of your code as a connection string.
Is this not c#? Because "var" isn't a normal object type in C#. Are you getting mixed up with javascript?
@pieps86
I thought of that after I had posted.
Hmm and you have debug stepped through to make sure nothing is mangling your objects?
Nope, nothing is getting skewed anywhere along the way. I even compared this code with older versions in Team Explorer to see if I could find anything that had been changed recently that would cause this error. Also, the problem only seems to be when I debug the project from within Visual Studio. I can put the DLL with this code in an engine and it runs fine.
"var" is introduced for LINQ and you can use it in case of lazy binding; where you dont know the data type at compile time.
if you will use it, application will run.. but you cant debug...
I don't know about that. I am, in fact, debugging to get this error. Using the 'var' keyword is not the issue. I can explicitly declare all types and still get the same result. Nonetheless, using 'var' does not prevent debugging. I'm in VS2008, btw.
So the error ONLY comes up in debugging, and not in a regular release?
That is very strange. Only thing I can think of is if you are pulling and values from the Properties section, they will be different between regular and debug runs.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Tim Johansson |
last post by:
I'm new to C++, and tried to start making a script that will shuffle an
array. Can someone please tell me what's wrong?
#include <iostream.h>
#include <string.h>
int main () {...
|
by: Michael.EJ.Reynolds |
last post by:
I'm having a ton of trouble with a dataset. It builds at design time,
but fails at runtime, saying:
---------------------------
Processing Errors
---------------------------
An error has...
|
by: Michael Lehn |
last post by:
Hi,
I have a question regarding the conversion of objects. When is the
conversion done by the constructor and when by the operator. My feeling
tells me that the constructor is preferred. But...
|
by: Steve Gough |
last post by:
Could anyone please help me to understand what is happening here? The
commented line produces an error, which is what I expected given that
there is no conversion defined from type double to type...
|
by: Richard Lewis Haggard |
last post by:
While looking at information on OracleCommand class, I was surprised to see
the Microsoft documentation saying "Note: This namespace, class, or member
is supported only in version 1.1 of the .NET...
|
by: fazulu deen |
last post by:
Hi all,
For the following code :
file_ptr = fopen("pass_fail.txt", "a"); // error line 393
fdisplay(file_ptr, "Test Passed");
fclose(file_ptr);
|
by: =?Utf-8?B?Sm9uIEphY29icw==?= |
last post by:
When I update a small table, no problem.
When I Update a single field on a single row in a large table,
OracleCommand.ExecuteNonQuery hangs and never comes back. Note, the where
clause specifies a...
|
by: Rahul |
last post by:
Hi Everyone,
I have the following code,
class B;
class A
{
public : operator B();
|
by: gecko |
last post by:
Hi,
Regarding : OracleCommand.ExecuteNonQuery()
Lets say I want to delete a record from a table and this deletion triggers other deletions from other tables.
So, does the number of rows...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |