Android Question SQLLite return science number

ttsolution

Member
Licensed User
Longtime User
Dear all,
I select price from SQLLite as follow query

mPrice=Main.SQL1.ExecQuerySingleResult("Select ifnull(PriceWithVAT,0) as PriceWithVAT from ProductPrice Where ItemCode='" & P.ItemCode & "'")

result : mPrice= 2.04039E7 (but the actual value is 20403831.8)

When I show the value to EditText, it is 2.04039E7 rather than 20403831.8

Many thanks for any help

Jonh,
 

Mahares

Expert
Licensed User
Longtime User
Another alternative to Erel and keirS good advice is to use the SUBSTR function like this without having to reformat the result:
B4X:
Dim mPrice As String
mPrice=Main.SQL1.ExecQuerySingleResult("Select ifnull(substr(PriceWithVAT,1),0) " _
& "from ProductPrice Where ItemCode='" & P.ItemCode & "'")
Log(mPrice)
 
Upvote 0

edgar_ortiz

Active Member
Licensed User
Longtime User
You can try:

mPrice=Main.SQL1.ExecQuerySingleResult("Select cast(ifnull(PriceWithVAT,0) as decimal(10,2)) as PriceWithVAT from ProductPrice Where ItemCode='" & P.ItemCode & "'")

Regards

Edgar
 
Upvote 0
Top