Link to home
Create AccountLog in
Avatar of arichexe
arichexe

asked on

invalid cast on float problem

MyField is defined as float in an MS-SQL database, but when I attempt to retrieve it from a result set via (float)rs["MyField"], I get an "invalid cast" error.  How can I remedy this?
Avatar of buraksarica
buraksarica
Flag of Türkiye image

try casting to an object, and set a breakpoint, and see the real type with quick watch. (try double btw)
ASKER CERTIFIED SOLUTION
Avatar of iandian
iandian
Flag of Netherlands image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account