Android Question Inserting data in views from MySQL

tjcoops

New Member
Licensed User
Longtime User
Hi Guys,

I'm new to MySQL and SQL altogether and I've been using the RDC Server and client to connect to my MySQL server. Everything seems to work, when I execute a query the correct result appears in the B4A Log. However I'm not sure how I can use this data in views on my app.

For example I have table listing all the machines/equipment at a local business and I want to populate a spinner with the names of these machines. I know that 'executespinner' can do this with DBUtils but that seems to only be for local DBs not remote MySQL servers.

It may seem like a newb question but any help will be greatly appreciated!

Thanks,
Tristan
 

derez

Expert
Licensed User
Longtime User
Something like this, with RDC:
B4X:
Sub JobDone(Job As HttpJob)
If Job.Success = False Then
    Log("Error: " & Job.ErrorMessage)
Else
If Job.JobName = "DBRequest" Then
Dim result As DBResult = reqManager.HandleJob(Job)
For Each records() As Object In result.Rows
      spinner1.add(records(0))
next
end if
The spinner should be defined and initialized elsewhere.
 
Last edited:
Upvote 0

tjcoops

New Member
Licensed User
Longtime User
Would you have any suggestions on how to deal with different jobs. For example, once I've populated the first spinner I want another spinner to be populated with the results from a query but my understanding is that the JobDone sub would just do it for spinner1.
 
Upvote 0

derez

Expert
Licensed User
Longtime User
When you send jobs, give them different tags for different jobs, like 6 here:
B4X:
reqManager.ExecuteCommand(cmd,6)
Then in jobdone you can select the action taken by the job.tag:
B4X:
Select Job.Tag
            Case 0
'                    Log("job 0 exec")
            Case 1

.....
 
Upvote 0
Top