views:

278

answers:

2

I'm using System.Data.SQLite to save data to database. In table there are 2 columns defined as float. However when I save data to DB it saves only integer part.

12.2345 => 12 11.5324 => 11 (I don't know how exactly it rounds, it just rounds)

Yes I'm sure I'm using floats in my application, and I'm sure that CommandText contains float numbers NOT integer.

A: 

There is no support for floats as build-in type. Use TEXT instead.

Fus
sqlite has a REAL
Nifle
My bad: REAL. The value is a floating point value, stored as an 8-byte IEEE floating point number.
Fus
+2  A: 

You need to be using floats in your application, but you also need to make sure the table entry in the SQLite database has been explicitly declared to be that REAL type.

Paul Hsieh