Android Question JRDC2 Update & Delete

Discussion in 'Android Questions' started by stevetheframe, Jun 1, 2019.

  1. stevetheframe

    stevetheframe New Member Licensed User

    I'm working with JRDC2 and sqlite. I can find examples of SELECT and INSERT, but not DELETE and UPDATE. Any pointers?
     
  2. Johan Hormaza

    Johan Hormaza Active Member Licensed User

    Server:
    upload_2019-6-1_20-56-8.png
    Code:
    Dim ID As Int
    ID = 2
    Dim req As DBRequestManager = CreateRequest
              
    Dim cmd As DBCommand = CreateCommand("UPDATE_table"Array (edtName.Text,edtLastName.Text,ID))
                
    Dim j As HttpJob = CreateRequest.ExecuteBatch(Array(cmd), Null)
                
    Wait For (req.ExecuteCommand(cmd,Null)) JobDone(j As HttpJob)
                
    If j.Success Then
                    
    Log("Update Successefull")
                
    Else
                    
    Log("ERROR Update" & j.ErrorMessage)
                
    End If
                j.Release
    Delete
    Code:
    Dim ID As Int
    ID = 2
    Dim req As DBRequestManager = CreateRequest
              
    Dim cmd As DBCommand = CreateCommand("Delete_Row"Array (ID))
                
    Dim j As HttpJob = CreateRequest.ExecuteBatch(Array(cmd), Null)
                
    Wait For (req.ExecuteCommand(cmd,Null)) JobDone(j As HttpJob)
                
    If j.Success Then
                    
    Log("Delete Row Successfull")
                
    Else
                    
    Log("ERROR Delete Row " & j.ErrorMessage)
                
    End If
                j.Release
    Code:
    Dim req As DBRequestManager = CreateRequest
              
    Dim cmd As DBCommand = CreateCommand("Delete_table"Array (NameTable.Text))
                
    Dim j As HttpJob = CreateRequest.ExecuteBatch(Array(cmd), Null)
                
    Wait For (req.ExecuteCommand(cmd,Null)) JobDone(j As HttpJob)
                
    If j.Success Then
                    
    Log("Delete Table Successefull")
                
    Else
                    
    Log("ERROR " & j.ErrorMessage)
                
    End If
                j.Release
    Something like that, anything you tell me.
     
    José J. Aguilar, DonManfred and Erel like this.
  3. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    by DELETE and UPDATE you can use the same code as on INSERT.
     
  4. stevetheframe

    stevetheframe New Member Licensed User

    Thanks. This is really helpful.
    The DELETE works now (I'd got mixed up with arrays and brackets).
    I'm still having problems with UPDATE, but I think this is unrelated ("values not bound to statement")
     
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