AlpVir Well-Known Member Licensed User Longtime User Sep 19, 2013 #1 Using HTTPUtils2 are able to read a single record (consisting of 2 fields L1 and L2) of an archive MSAccess that resides in the web. I use the following statement ASP 3.0 : Code: Copy rs.Open "SELECT L1, L2 FROM T WHERE TabbC = '" & strT & "'", cnn response.write rs ("L1") & "#" & rs ("L2") From the B4A side then I can easily separate L1 and L2. If, however, there are more records I can write (ASP side) a loop : Code: Copy do response.write rs ("L1") & "#" & rs ("L2") response.write "@" rs.MoveNext loop until rs.eof I use the field separator # and the record separator @. From the B4A side are I equally able to separate the fields of all records. B4A side 1 Code: Copy Dim Job As HttpJob Job.Initialize("Job", Me) Job.Download2(Site & "/ReadMDB.asp", _ Array As String("T", T)) B4 side 2 Code: Copy Sub JobDone (Job As HttpJob) If Job.Success = True Then OutputX = Job.GetString Msgbox (OutputX,"") End If End Sub Is there any method more efficient and elegant ? Thanks in advance Last edited: Sep 19, 2013
Using HTTPUtils2 are able to read a single record (consisting of 2 fields L1 and L2) of an archive MSAccess that resides in the web. I use the following statement ASP 3.0 : Code: Copy rs.Open "SELECT L1, L2 FROM T WHERE TabbC = '" & strT & "'", cnn response.write rs ("L1") & "#" & rs ("L2") From the B4A side then I can easily separate L1 and L2. If, however, there are more records I can write (ASP side) a loop : Code: Copy do response.write rs ("L1") & "#" & rs ("L2") response.write "@" rs.MoveNext loop until rs.eof I use the field separator # and the record separator @. From the B4A side are I equally able to separate the fields of all records. B4A side 1 Code: Copy Dim Job As HttpJob Job.Initialize("Job", Me) Job.Download2(Site & "/ReadMDB.asp", _ Array As String("T", T)) B4 side 2 Code: Copy Sub JobDone (Job As HttpJob) If Job.Success = True Then OutputX = Job.GetString Msgbox (OutputX,"") End If End Sub Is there any method more efficient and elegant ? Thanks in advance
Erel B4X founder Staff member Licensed User Longtime User Sep 20, 2013 #2 See this example: Connect Android to MS SQL Server Tutorial It returns a JSON string. This is more robust. In your code I don't see where you are splitting the string. You can use Regex.Split for that. Upvote 0
See this example: Connect Android to MS SQL Server Tutorial It returns a JSON string. This is more robust. In your code I don't see where you are splitting the string. You can use Regex.Split for that.