import csv et double quote (")
Bonjour,
J'essaye d'importer un .csv dans un dataset et de l'afficher dans un datagridview
Voici le code d'import :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Public Function GetCsvData(ByVal strFolderPath As String, ByVal strFileName As String) As DataTable
Dim strConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFolderPath & ";Extended Properties=""text;HDR=YES;"""
Dim conn As New OleDbConnection(strConnString)
Try
conn.Open()
Dim cmd As New OleDbCommand("SELECT * FROM [" & strFileName & "]", conn)
Dim da As New OleDbDataAdapter()
da.SelectCommand = cmd
da.Fill(ds)
da.Dispose()
Return ds.Tables(0)
Catch
Return Nothing
Finally
conn.Close()
End Try
End Function |
ça marche.....sauf sur cette ligne :
;;ERMITAGE DU PIC SAINT LOUP "TOUR DE PIERRES";2009;Bouteille;COTEAUX DU LANGUEDOC - PIC ST LOUP;Languedoc-Roussillon;Rouge;0,75;12;Vin;19,60;1;0;7,53;9,00;47;47;1;;;;;;0;0;;0; ; ; ; ; ; ;21966
l'import ne marche avec les " de "TOUR DE PIERRES" même en délimitant le fichier avec point virgule dans schema.ini !!
Comment résoudre ce problème ?
Merci d'avance
Guillaume