Save numbers with many decimal places in sqlite

ThePuiu

Active Member
Licensed User
Longtime User
I have a sqlite database where is a table that contains a field of type decimal (18,13). In it I try to save the contents of an EditText which contain something like 46.7654239810 using:
B4X:
mySQL.ExecNonQuery2("INSERT INTO OBS VALUES (?,?,?)",Array As Object(Null, Latitude.Text.Trim, Longitude.Text.Trim)
but the final result (in database) is a number with only 4 decimals..

What is wrong?
 

Mahares

Expert
Licensed User
Longtime User
Did you try this?
B4X:
NumberFormat2(Latitude.Text,2,10,10,False)
NumberFormat2(Longitude.Text,2,10,10,False)
instead of:
Latitude.Text.Trim and Longitude.Text.Trim
 
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
Yes, I tried this:
NumberFormat2(Latitudine.Text.Trim,2,10,13,False)
but the result is the same ...
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
You can try changing the field type in SQLite for the longitude and latitude to TEXT instead of Decimal. SQLite accepts any data type in a TEXT field. It might cure the problem. Basically with SQLite you have 4 data types: INTEGER, BLOB, TEXT, REAL
 
Last edited:
Upvote 0
Top