sub readcsv
Dim Reader As TextReader
Reader.Initialize(File.OpenInput(Main.PthIO, nomefilelocale))
Dim line As String
line = Reader.ReadLine
'nella prima linea c'è l'intestazione
line = Reader.ReadLine
Do While line <> Null
DoEvents
Dim sColumn() As String
sColumn = Regex.Split(";", line)
ImportCSV(sColumn)
line = Reader.ReadLine
Loop
DoEvents
Main.dbSql.TransactionSuccessful
Main.dbSql.EndTransaction
ProgressDialogHide
end sub
Sub ImportCsv(sColumn()As String)
Dim AppColumn (3) As String
strquery ="INSERT or REPLACE INTO tabella(col1, col2, col3)"
strquery = strquery & " VALUES ('" & AppColumn(0) & "','"& AppColumn(1) & "','"& AppColumn(2) & "')"
Log(strquery)
Main.dbSql.ExecNonQuery(strquery)
End Sub