Android Question db numeric value

Discussion in 'Android Questions' started by Kiran Raotole, Aug 9, 2018.

  1. Kiran Raotole

    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
    Code:
    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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Tip: Use the smart string literal:

    Code:
    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?
     
  3. Kiran Raotole

    Kiran Raotole Active Member Licensed User

    famt is deciaml(15,2)
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    1.I'm asking about the SQLite database.

    2. What is the value of:
    Code:
    Log(amt)
    ?
     
  5. Kiran Raotole

    Kiran Raotole Active Member Licensed User

    sql database value == 152449
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    So the problem is with the code that fetches the data from the remote database. I recommend you to switch to jRDC2. It will be simpler, perform better and more secure.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice