Sub GetNotSent
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("get_notsent", Array())
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)
For Each row() As Object In res.Rows
MyID = row(res.Columns.Get("id"))
MyCity = row(res.Columns.Get("city"))
MyProduct1 = row(res.Columns.Get("product1"))
Log("ID: " & MyID)
Log("City: " & MyCity)
Log("Product: " & MyProduct1)
'NOW Call another Query here for each row and wait before moving to next row()
GetTopic(MyCity)
Next
Else
Log("ERROR: " & j.ErrorMessage)
End If
j.Release
End Sub
Sub GetTopic (city As String)
Dim req2 As DBRequestManager = CreateRequest
Dim cmd2 As DBCommand = CreateCommand("get_fbtopic", Array(city))
Wait For (req2.ExecuteQuery(cmd2, 0, Null)) JobDone(j As HttpJob)
If j.Success Then
req2.HandleJobAsync(j, "req2")
Wait For (req2) req2_Result(res2 As DBResult)
'work with result
For Each row() As Object In res2.Rows
MyTopic = row(res2.Columns.Get("username"))
Log("Topic: " & MyTopic)
Next
Else
Log("ERROR: " & j.ErrorMessage)
End If
j.Release
End Sub