Last post Oct 29, 2015 05:41 PM by a2h
Oct 29, 2015 04:54 PM|gerben6969|LINK
Hi can you guys help me out here.
I want to extract a float from my database using a sqlreader. Next I want to cast it to a float in my MVC. But I always have a castexception.
Can anyone of you tell me the correct way to do this?
Oct 29, 2015 05:41 PM|A2H|LINK
You can try casting to double and then to float.
Try with the below code
float convertedvalue = (float)(double)reader["YourColumnName"];
You can check this discussion for more details