Reading money Type Field in SQL CE

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?
 
A

Alex Feinman [MVP]

Try using Convert.ToXXX:
float myFloat = Convert.ToSingle(mySqlCeDataReader["SomeField"]);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top