Android Question SQLLite return science number

ttsolution

Member
Licensed 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,
 

keirS

Well-Known Member
Licensed User
Use the NumberFormat function to format the number for display in the Editext.
 

Mahares

Well Known Member
Licensed 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)
 

edgar_ortiz

Active Member
Licensed 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
 
Top