Android Question Save CSV method for SQL Cursor

b4auser1

Well-Known Member
Licensed User
Longtime User
Is there a Sub to produce String in CSV format from the current Row in SQL Cursor ?
Something like Public Sub SQLtoCSV(SQL As SQL, DBTypes As List) As String
It's not difficult to develop the Sub, but I don't want to invent a wheel :)
 

derez

Expert
Licensed User
Longtime User
You can try this:
B4X:
Dim csv As String = ""
For i = 0 To cur.ColumnCount - 2
    csv = csv & cur.GetString2(i) &  ","
Next
csv = csv & cur.GetString2(cur.ColumnCount - 1)
If cur is not global - you have to supply it to the sub and define its position to get the row. This is probably done after the SELECT query is done.
Return the csv string.
 
Last edited:
Upvote 0
Top