Android Question db numeric value

Kiran Raotole

Active Member
Licensed User
After inserting numeric value in database and the value is round
I have a php code and get value = 152448.52

my b4a code is
B4X:
amt            = m.Get("mamt")

        sql.ExecNonQuery2("INSERT INTO gl " & _
                            "(fbook,faccode,fdesc,fplace,fitcu,fin1,ftype," & _
                            "famt,fq1,fq2,fq3,frate1,frate2,frate3,fgst1,fvat2,fnum1,fnum2,fnum3,fnum4,fnum5) VALUES " & _
                            "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", _
                            Array As String(book,accode,desc,place,itcu,in1,ftype, _
                            amt,q1,q2,q3,rate1,rate2,rate3,gst1,vat2,num1,num2,num3,num4,num5))

Log :
Log("JSON === " & amt) := JSON === 152448.52
Log(tr.ExecQuerySingleResult("select famt from gl where fbook='G001' and faccode='MAI1'")) :=152449
 

Kiran Raotole

Active Member
Licensed User
Tip: Use the smart string literal:

B4X:
  sql.ExecNonQuery2($"INSERT INTO gl
                            (fbook,faccode,fdesc,fplace,fitcu,fin1,ftype,
                                             famt,fq1,fq2,fq3,frate1,frate2,frate3,fgst1,fvat2,fnum1,fnum2,fnum3,fnum4,fnum5) VALUES
                            (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"$, _
What is the column type of the relevant field?
famt is deciaml(15,2)
 
Upvote 0
Top