A much more efficient and better implementation is available in jRDC2.
Thanks Erel, I will study jRDC2.
For study purposes and to prove that the ASP server in the example can be done in B4J, you should convert this
aspnet server code
...
JavaScriptSerializer j = new JavaScriptSerializer();
Response.Write(j.Serialize(list.ToArray()));
...
in B4J code.
I'm stranded here: (
B4J server)
Sub Handle(req As ServletRequest, resp As ServletResponse)
mreq = req
mresp = resp
Dim miasql As String, ser As B4XSerializator, lista As List
miasql=mreq.GetParameter("query")
lista=ExecuteMemoryTable(Main.sql1, miasql , Null, 0 )
resp.ContentType ="text/html" '????????????
resp.Write( ser.ConvertObjectToBytes(lista)) '???????????????
' What is the correct code?
End Sub
This is the
B4A client code that works well with asp server
Sub JobDone (Job As HttpJob)
If Job.Success Then
Dim parser As JSONParser
Dim response As String = Job.GetString
parser.Initialize(response)
Dim rows As List
rows = parser.NextArray
Select Case Job.JobName
Case "Job0"
'work with result
'rows is a List. Each item is a Map with the columns names as keys and the db values as the values.
For i = 0 To rows.Size - 1
Log("Rows #" & i)
Dim m As Map
m = rows.Get(i)
TotPersone.Text=m.Get("TotPersone")
Next
.....
....