11 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for edogg23

Hello. I'm trying to use SqlDataReader to return information from my database. It works fine until it comes to a datetime field. I'm getting an error saying: " Input string was not in a correct format." on the line where I'm declaring a variable to hold my field. Here is …

Member Avatar for edogg23
0
4K
Member Avatar for sciwizeh

Hello all, I have not tested the code I'm posting here to see if it compiles, but I have an issue in a large codebase and I believe that this should be the simplest program to demonstrate the issue; class base { public: shared_ptr<base> clone()=0; }; typedef shared_ptr<base> baseptr; class …

Member Avatar for sciwizeh
0
20K
Member Avatar for James19142

I need a way to do a cast without being returned a pointer to a new address but, the same address as the original. Something like this: derivedClass something_derived; baseClass* basePointer = &something_dervived; derivedClass* derivedPointer = static_cast <derivedClass*> (basePointer); /* my problem is "derivedPointer" isnt assigned the same address as …

Member Avatar for James19142
0
186
Member Avatar for rahul.ch

import java.util.*; public class Elway { public static void main(String r[]) { ArrayList[] ls = new ArrayList[3]; for(int i=0; i<3; i++) { ls[i] = new ArrayList(); ls[i].add("a" + i); } Object o = ls; do3(ls); for(int i=0; i<3; i++) //insert code here } static Object do3(ArrayList[] a) { for(int i=0; …

Member Avatar for rahul.ch
0
284
Member Avatar for rahul.ch

Given: Sour extends Blue extends Pan `Pan p4 = new Sour();` Then set of 6 new statements given and asked to choose which ones will compile. They are: 1. `Pan p5 = p4;` 2. `Pan p6 = (Blue)p4;` 3. `Blue b2 = (Blue)b4;` 4. `Blue b3 = (Sour)p4;` 5. `Sour …

Member Avatar for JamesCherrill
0
197
Member Avatar for rahul.ch

Compiles fine. But at runtime it gives ClassCastException. My doubt is that why is it so even though st which is of type Sample1 gets casted to Sample2 and generates exception even though Sample2 IS-A Sample1.

Member Avatar for rahul.ch
0
242
Member Avatar for bornwith

I am trying to catch the System.InvalidCastException error. If I put a number into the calculator the program runs ok. If the calculate button is pressed with nothing in the text boxes I get the casting error Conversion from string "" to type 'Decimal' is not valid. I understand why …

Member Avatar for bornwith
0
159
Member Avatar for ddanbe

The next code from the book "Pro-linq language itegrated query in C# 2008" gives a casting exception error on line 29. I know ToArray returns an array of objects, which are in fact of type Employee so why it generates an error? [CODE=C#]public class Employee { public int id; public …

Member Avatar for ddanbe
0
129
Member Avatar for micmo

Hi Guys, I'm currently developing a project using WCF (hosted on local IIS) which connects to a local SQL database using LINQ to get data. My problem is that when I run the code, 9/10 times it'll fail with the "Specified Cast Is Not Valid" error, but the other 1/10 …

Member Avatar for micmo
0
1K
Member Avatar for epicasian

Well, I've been Googling for at least 30 minutes, and looking through past posts about this, but just can't seem to find an answer that works. Basically, I've got a component class that has a single method I'm trying to test out. The entity class has a private array of …

Member Avatar for epicasian
0
214
Member Avatar for GBoyle

I am writing a model economy in which corporations (class BCorp) and persons (class BPrsn) act as agents buying and selling goods and services. I have a pool of contacts (class BContact) in which contact information is retained about each contact between agents. In a contact object I store a …

Member Avatar for GBoyle
0
142

The End.