Android Question B4XTable error adding line

Discussion in 'Android Questions' started by makis_best, Apr 20, 2019.

  1. makis_best

    makis_best Active Member Licensed User


    I try to add a line into B4Xtable getting the info from another table.

    My code is
    B4XTable1.sql1.ExecNonQuery2($"INSERT INTO data VALUES( ?, ?, ?, ?, ?, ?)"$Array As Object( ItemTable_All_Items.GetValue(0,row), _
    1,row), NumberFormat2(Price1, 104False), _
    NumberFormat2(Quantity1, 102False), ItemTable_All_Items.GetValue(2,row), _
    NumberFormat2(Quantity1*Price1, 102False)))
    If I execute a log() before I execute ExecNonQuery2, log() show my data correctly
    Log(ItemTable_All_Items.GetValue(0,row) & " - " & ItemTable_All_Items.GetValue(1,row) & " - " & NumberFormat2(Price1, 104False) & " - " & _
    NumberFormat2(Quantity1, 102False) & " - " & ItemTable_All_Items.GetValue(2,row) & " - " & NumberFormat2(Quantity1*Price1, 102False))

    But ExecNonQuery2 always return the error
    Why? What I am doing wrong?
    Last edited: Apr 20, 2019
  2. Erel

    Erel Administrator Staff Member Licensed User

    It is a mistake to use NumberFormat here. Add the real numbers and let B4XTable format them for you.

    Have you called SetData on B4XTable1? The database is only created when you call SetData. Note that the db creation is async so it will not be immediately available.
    You can wait for it to be ready with:
    Wait For B4XTable1_DataUpdated
    'ready here
  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