I'm working with JRDC2 and sqlite. I can find examples of SELECT and INSERT, but not DELETE and UPDATE. Any pointers?
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
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
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
by DELETE and UPDATE you can use the same code as on INSERT.DELETE and UPDATE
I'm working with JRDC2 and sqlite. I can find examples of SELECT and INSERT, but not DELETE and UPDATE. Any pointers?
Thanks. This is really helpful.Server:
View attachment 80939
DeleteB4X: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
B4X: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
Something like that, anything you tell me.B4X: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