Re: Cast is not valid



You might want to try reading the value as a float then using the
Convert.ToDouble function to convert the value to a double such as

d = Convert.ToDouble(reader.GetFloat(index))

--
This posting is provided "AS IS" with no warranties, and confers no rights.

Regards,
Uwa Agbonile[MSFT]

"Örjan Fjällborg" <rjan Fj llborg@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:A3419DA6-D8E6-458F-A8BC-6BC3BDEE3294@xxxxxxxxxxxxxxxx
> Hi!
>
> I get an exception (cast is not valid) when i try to use the GetDouble()
> method on a OleDataReader. I know that the field that I am reading is of
> double precision but when I watch the field in the debugger it says that
the
> ValueType is Single. How do I instruct the OleDataReader to read the field
as
> a Double instead? Is it possible?
>
> Best regards
> Örjan Fjällborg
> LKAB


.



Relevant Pages

  • Re: fread()
    ... > int i,istat,iaccum,intype; ... reading binary data from standard input? ... Use sizeof (float), or even better, sizeof *floatarray, instead. ... FLOAT, and set istat accordingly? ...
    (comp.lang.c)
  • Re: newbie trouble reading long floating point
    ... Are you reading floats or double? ... The sizes of float and double are ... to the first element of the array. ... Keith Thompson kst-u@xxxxxxx ...
    (comp.lang.c)
  • Re: newbie trouble reading long floating point
    ... The Unix "od" command with the specified arguments reads 10 8-byte ... Are you reading floats or double? ... The sizes of float and double are ... to the first element of the array. ...
    (comp.lang.c)
  • Re: An Algorithm For Hiring People?
    ... Not exactly -they all have similar rule of thumb instead of being ... thumb with HR is to approve of a person who praises his past employer ... their reading of the candidate is going to be identical if you follow ...
    (sci.research.careers)
  • Re: Marion Jones and Martina Hingis
    ... as regards their actions because that is absolutely a very large part ... really looks like you're incapable of reading comprehension. ... you understand why you dismiss all the other possible gods, ...
    (rec.sport.football.college)

Loading