Hello,
i am using this sub to load and copy rows from a csv file into sqlite, it works however this also import the csv headers and i need to skip them, also is this a good pratice? thank you.
i am using this sub to load and copy rows from a csv file into sqlite, it works however this also import the csv headers and i need to skip them, also is this a good pratice? thank you.
B4X:
Sub globals
Dim su As StringUtils
End Sub
Sub write_click
Try
SQL1.BeginTransaction
Dim lst1 As List
lst1 = su.LoadCSV(File.DirInternalCache, "zend_export.csv", ",")
For i = 0 To lst1.Size - 1
Dim sColumn() As String
sColumn = lst1.Get(i)
SQL1.ExecNonQuery2("INSERT INTO zend_values (a,b,c,d,e,f,d,h) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", sColumn)
Next
SQL1.TransactionSuccessful
Catch
Log(LastException.Message)
End Try
SQL1.EndTransaction
Msgbox("ok","Insert into")
End Sub
Last edited: