B b4auser1 Well-Known Member Licensed User Longtime User Feb 22, 2014 #1 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
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 Feb 22, 2014 #2 You can try this: Code: Copy 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: Feb 22, 2014 Upvote 0
You can try this: Code: Copy 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.
Erel B4X founder Staff member Licensed User Longtime User Feb 23, 2014 #3 You should use DBUtils.ExecuteMemoryTable and then convert it to csv with StringUtils.SaveCSV. Upvote 0