Hi again, friends!
How are you all?
I need to save sql database data as an html file.
By the experience I have with another BASIC like language, I'm using something like this:
It is working fine, but I would like to know if there is another better way of do it.
Another question: in the other BASIC like language I use, I can do
then I think my code would be something like this (only a example):
The question is: is there some equivalent way of doing the same with B4X strings?
Thank you in advance, friends!
Cheers
Uederson
How are you all?
I need to save sql database data as an html file.
By the experience I have with another BASIC like language, I'm using something like this:
B4X:
lista.AddAll(Array As String("<html>","<head>","<body>","<table>","<thead>","<thead>","<th>Data</th><th>Column1</th><th>Column2</th><th>Column3</th><th>Column3</th></thead>","<tbody>"))
cursor = Starter.SQL1.ExecQuery("SELECT * FROM records")
For i = 0 To cursor.RowCount - 1
cursor.Position = i
lista.Add("<tr><td>"&cursor.GetString("date")&"</td>")
lista.Add("<td>"&cursor.GetString("services")&"</td>")
lista.Add("<td>"&cursor.GetString("input")&"</td>")
lista.Add("<td>"&cursor.GetString("output")&"</td>")
lista.Add("<td>"&cursor.GetString("values")&"</td></tr>")
Next
cursor.Close
lista.AddAll(Array As String("</table>","</body>","</html>"))
File.WriteList(File.DirRootExternal, "page.html", lista)
It is working fine, but I would like to know if there is another better way of do it.
Another question: in the other BASIC like language I use, I can do
B4X:
variable = "<html>"
variable += "<head>"
then I think my code would be something like this (only a example):
B4X:
page = "<html>"&CRLF&"<head>"&CRLF&"<body>"&CRLF&"<table>"&CRLF&"<thead>"&CRLF&"<thead>"& _
"<th>Column1</th><th>Column2</th><th>Column3</th><th>Column3</th></thead>"&CRLF&"<tbody>"
cursor = Starter.SQL1.ExecQuery("SELECT * FROM records")
For i = 0 To cursor.RowCount - 1
cursor.Position = i
page += "<tr><td>"&cursor.GetString("date")&"</td>"& _
"<td>"&cursor.GetString("services")&"</td>"& _
"<td>"&cursor.GetString("input")&"</td>"& _
"<td>"&cursor.GetString("output")&"</td>"& _
"<td>"&cursor.GetString("values")&"</td></tr>"
Next
cursor.Close
File.WriteString(File.DirDefaultExternal,"page.html",page)
The question is: is there some equivalent way of doing the same with B4X strings?
Thank you in advance, friends!
Cheers
Uederson