Hi Everyone,
Do we have clear sample for sql lite to text file format?
Thanks,
Maloyski
Do we have clear sample for sql lite to text file format?
Thanks,
Maloyski
Dim sql1 As SQL = ... open database
Dim rs As ResultSet = sql1.ExecQuery2("SELECT * FROM TableName WHERE PhotoId = ?",Array As String(PhotoId))
Do While rs.NextRow
'build a string here with the fields rs.GetString(index)
'and use a sub around to replace the delimiter char
'read sql docu
Loop
rs.Close
'... Close database
As an example, for my needs, I need to embed an existing sqlite db as a JSON text string for 'read' only access to a webapp im using, for example, banano without having to re-create the whole thing.Why do you need a database converted into a text file
Something like this should do it:Hi Everyone,
Do we have clear sample for sql lite to text file format?
Thanks,
Maloyski
Sub Cursor2CSV(Cursor1 As Cursor, strFolder As String, strCSVFileName As String)
Dim i As Long
Dim c As Long
Dim lstCSV As List
Dim UB As Long
Dim UB2 As Int
UB = Cursor1.RowCount - 1
UB2 = Cursor1.ColumnCount - 1
Dim arrFields(UB2 + 1) As String
lstCSV.Initialize
Cursor1.Position = 0
For c = 0 To UB2
arrFields(c) = Cursor1.GetColumnName(c)
Next
lstCSV.Add(arrFields)
For i = 0 To UB
Dim Cols(UB2 + 1) As String 'needs to be in the loop, to add new array at every iteration
Cursor1.Position = i
For c = 0 To UB2
Cols(c) = Cursor1.GetString2(c)
If Cols(c) = Null Then 'to avoid an error at su.SaveCSV
Cols(c) = ""
End If
Next
lstCSV.Add(Cols)
Next
sUtils.SaveCSV(strFolder, strCSVFileName, ",", lstCSV)
End Sub
select max(length(field1)) from table1u need to process this data later?
if not u can count each column size and fill it with spaces.
i not saw any field size commands in the sql class but maybe u can get the field size with a query.