Hi,
I'm trying to import a set of rows from a csv file into a db using ExecNonQuery2. It seems to work fine when the list object contains 1 or 2 rows of data, but fails when there are more. I've looked in the help files and searched the forums but I don't find any info on such a limit (I thought the limit would either be 1 or none, but 2?).
The relevant code:
Thanks for any info,
Julio
I'm trying to import a set of rows from a csv file into a db using ExecNonQuery2. It seems to work fine when the list object contains 1 or 2 rows of data, but fails when there are more. I've looked in the help files and searched the forums but I don't find any info on such a limit (I thought the limit would either be 1 or none, but 2?).
The relevant code:
B4X:
' Data in csv file: (read ok by lst1)
' "HQ", "00", "Ground floor"
' "HQ", "01", "First floor"
' "HQ", "02", "Second floor"
Dim lst1 As List
lst1 = su.LoadCSV(sFilePath, sFlFile, "|")
Log (lst1.Size) 'Returns 3, as expected
Dim sColumn() As String 'Added for debugging
sColumn = lst1.Get(0)
Log(sColumn.Length) '3, OK
Log(sColumn(0)) '=HQ, OK
Log(sColumn(1)) '=00 , OK
Log(sColumn(2)) '=Ground floor, OK
Try
sql1.ExecNonQuery2("INSERT INTO fl (bl_id, fl_id, description) VALUES (?, ?, ?)", lst1)
Catch
'None if only two rows in CSV, otherwise:
Log(LastException.Message)' -> android.database.sqlite.SQLiteException: bind or column index out of range: handle 0x234c70
End Try
Thanks for any info,
Julio