Android Question Stored Procedure using jRDC2

Chris Guanzon

Active Member
Licensed User
Longtime User
Hello everyone,

I need help on how to use stored procedure in B4A using jRDC2.

This is my code in B4A

B4X:
Sub UserLogin As ResumableSub
    Try
        Dim req As DBRequestManager = CreateRequest
        Dim cmd As DBCommand = CreateCommand("pLogin", Array(EditText1.Text, EditText2.Text))
        Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone (j As HttpJob)
        If j.Success Then
            req.HandleJobAsync(j, "req")
            Wait For (req) req_Result (res As DBResult)
            'work with result
            req.PrintTable(res)
            If res.Rows.Size = 0 Then
                MsgboxAsync("Invalid user credentials, please try again", "Error")
                Wait For Msgbox_Result
                Return False
            Else
                For Each row() As Object In res.Rows
                    Variables.Name = row(res.Columns.Get("firstname")) & " " & row(res.Columns.Get("lastname"))
                Next
                Return True
            End If
        Else
            MsgboxAsync("Cannot connect to the server, please check your internet connection and try again.", "Error")
            Wait For Msgbox_Result
            Log("ERROR: " & j.ErrorMessage)
            Return False
        End If
        
        j.Release
    Catch
        MsgboxAsync("An error occurred, please try again later.", "Error")
        Wait For Msgbox_Result
        Log(LastException)
        Return False
    End Try
    
End Sub

and this is the code in .config file in jRDC2

B4X:
sql.pLogin=CALL pLogin(?,?)

I don't know if this is the right way to do it. Is there a way to use it?

I've already search the forum but i can't find any that uses jRDC2.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
 
Upvote 0
Top