Android Question JdbcSQL Insert Statement not Executing

For some reasons I get success = true for highlighted lines but table still is empty when I check. Is like the insert statement is not executed.
What I'm I doing wrong?.. Please kindly help. Thank you.

B4X:
Sub submit_order As ResumableSub
    ProgressDialogShow2("Please Wait, Saving",False)
    DateTime.DateFormat = "ddMMyyhhmmss"
   
    For i = 0 To CustomListView1.GetSize - 1
        Dim p As String = CustomListView1.GetValue(i)
        Dim buffer() As String = Regex.Split(CRLF, p)
       
        Dim productnamee As String = buffer(0)
        Dim pricee As String = buffer(1)
        Dim quanti As String = buffer(2)
        Dim uomm As String = buffer(3)
        Dim costprice As String = buffer(4)
       
        Dim no As Long
        Dim day As String
        Dim dateadded As String
       
        DateTime.DateFormat = "MMMM dd, yyyy"
        no = DateTime.GetDayOfWeek(DateTime.Now)
        If no = 1 Then
            day = "Sunday"
        else if no = 2 Then
            day = "Monday"
        else if no = 3 Then
            day = "Tuesday"
        else if no = 4 Then
            day = "Wednesday"
        else if no = 5 Then
            day = "Thursday"
        else if no = 6 Then
            day = "Friday"
        else if no = 7 Then
            day = "Saturday"
        End If
       
        dateadded =day &", "&  DateTime.Date(DateTime.now)
        Dim totalamountsales As String = (quanti) * (pricee)
   
mysql.AddNonQueryToBatch("insert into sales_autosaved (billno,customername,employeename,datetimeprocessed,productname,qty,uom,price,discount,totalamount,amountpaid,status,costprice,fromwhere,counter_tab_name) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", Array As Object (orderlist.text , orderlist.text ,salesperson_multi.Text, dateadded , productnamee ,quanti, uomm , pricee ,0,totalamountsales  ,0,"Pending",costprice,"ORDER APP",tablename.text))

    Next
   
    Wait For (Connect) Complete (Success As Boolean)

    If Success Then
        Dim SenderFilter As Object = mysql.ExecNonQueryBatch("SQL")
    Wait For (SenderFilter) SQL_NonQueryComplete (Success As Boolean)
    Log("NonQuery: " & Success)
   
    If Success Then
        Log(Success)
            'Log(LastException)
    Else
        Log(LastException)
    End If
    End If
   
    ProgressDialogHide
   
    Return Success
End Sub
 

OliverA

Expert
Licensed User
Longtime User
Upvote 0

OliverA

Expert
Licensed User
Longtime User
I'm pretty sure that connecting to the database resets your mysql object and therefore clears out any pending AddNonQueryToBatch entries. Therefore your code works correctly, just not the way you expect it. Connect first, create you batch entries, then submit your batch.
 
Upvote 0
Okay. Let me try that and revert.. Thanks a lot.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…