SqlCeDataReader on SQL Mobile 5.0

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a strange bug which appears only with the new SQL Mobile version.

A database field is declared as 'float' type, and with SQL CE 2 it was read
with SqlCeDataReader.GetFloat(i) all was fine.

But on WM 5 it generates an 'InvalidCastEception', and I have to use
GetDouble(i) instead of GetFloat ...

What's the trick ?
 
Bertrand,

This is not a WM5 issue, it is a CF2 CLR change.

Float in SQL CE and SQL Mobile are defined as
Floating point number data from -1.79E +308 through 1.79E+308

Storage size is 8 bytes (64 bits)

I think in CF 2.0 a Double now maps to this precision

http://msdn2.microsoft.com/en-us/library/678hzkk9(VS.80).aspx

You can always use GetValue(x) on your SqlCeDataReader and
cast the value to a float is the number allows it.

Also - thiere is a newsgroup for SQL CE/SQL Mobile at:
microsoft.public.sqlserver.ce or
http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=152&SiteID=1
--
Darren Shaffer
..NET Compact Framework MVP
Principal Architect
Connected Innovation
www.connectedinnovation.com
 
Back
Top