I have this code
The problem is some of the fields contain commas thus throwing the cells out. How can i overcome this. The txt file is for all intents unalterable.
B4X:
Dim su As StringUtils
Dim Table,sqlTable As List
Dim Cells() As String
Dim m As Map
Dim i As Int
SQL.ExecNonQuery("DELETE FROM Products")
Table = su.LoadCSV(File.DirInternal, "some.txt", TAB)
sqlTable.Initialize
For i = 0 To Table.Size - 1
Cells = Table.Get(i)
m.Initialize
m.Put("Code", Cells(0))
m.Put("Desc", Cells(1))
m.Put("Loc", Cells(2))
m.Put("SOH", Cells(5))
sqlTable.Add(m)
Next
DBUtils.InsertMaps(SQL,"Products", sqlTable)
The problem is some of the fields contain commas thus throwing the cells out. How can i overcome this. The txt file is for all intents unalterable.