I am reading a csv file through a Console Application, and to this point it is returning me correctly.
Now I'm having trouble understanding how to include each field in a Bank column.
This is the code I have so far.
Public Function LerCsvConfrec()
Dim sb As New StringBuilder
Dim ds As New DataSet
Dim dtConfrec As New DataTable
Dim maquinaProducao As String = "PRODUCAO"
Dim pastaOrigem As String = ""
Dim pastaDestino As String = ""
If Environment.MachineName = "PRODUCAO" Then
'PRODUÇÃO
pastaOrigem = "C:\KAWASAKI\FTP\SUPPORTE-UBERLANDIA\INBOUND\CONFREC\"
pastaDestino = "C:\KAWASAKI\FTP\SUPPORTE-UBERLANDIA\INBOUND\CONFREC\Lidos\"
Else
'TESTE
pastaOrigem = "C:\temp\Confrec\"
pastaDestino = "C:\temp\Confrec\Lidos\"
End If
'Busca arquivos .csv na Pasta de Origem
Dim dirCsv As String() = Directory.GetFiles(pastaOrigem, "*.csv")
Try
For Each csvFile In dirCsv
'Lê o conteúdo de cada arquivo
Dim arqCsv As String = File.ReadAllText(csvFile)
For Each linha As String In arqCsv.Split(vbCrLf)
'Verifica se não está vazio
If Not String.IsNullOrEmpty(linha) Then
'Delimitador de separação usado (;)
For Each coluna As String In linha.Split(";")
Next
End If
Next
Next
Catch ex As Exception
End Try
End Function
I checked the information that comes back and every time it passes through
For Each coluna As String In linha.Split(";")
Next
It returns the right information, but I could not insert it into the database. How can I make each CSV column enter the correct Bank column?