Reading money Type Field in SQL CE

  • Thread starter Thread starter Ghost
  • Start date Start date
G

Ghost

Hello.
I have some problem to read Money Type Field from my SQL CE database.
I do so:
I'm using SqlCeDataReader object to select some records and I have "float"
type variable to store result.
I write:

myFloatVar = (float)mySqlCeDataReader["SomeField"];

When this line executed the cast exception occurs.

The same problem I have when I'm try to assign record value to "char" type
variable.

myCharVar = (char)mySqlCeDataReader["SomeField"];

How do I these assignments?
 
Try using Convert.ToXXX:
float myFloat = Convert.ToSingle(mySqlCeDataReader["SomeField"]);
 
Back
Top