Pharse a CSV file

  • Thread starter Thread starter Guest
  • Start date Start date
Use the OleDb provider to read the csv file just like you would for a database

Tu-Thac
www.ongtech.co

----- Saif Khan wrote: ----

Hi
How do I pharse a CSV file and send the data to a database. This file is hugh

Thanks
 
Hi Saif,

You can make a dataset, but with that you do not have it in your database.
(The delimiter has to be in your culture setting)

But it is a start. Here how to do it.
I hope this helps?

Cor

\\\
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim file As String = "Test2.txt"
Dim path As String = "C:\"
Dim ds As New DataSet
Try
Dim f As System.IO.File
If f.Exists(path & file) Then
Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
path & ";Extended Properties=""Text;HDR=No;FMT=Delimited\"""
Dim conn As New OleDb.OleDbConnection(ConStr)
Dim da As New OleDb.OleDbDataAdapter("Select * from " & _
file, conn)
da.Fill(ds, "TextFile")
End If
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
///
 
¤ Hi,
¤ How do I pharse a CSV file and send the data to a database. This file is hugh.
¤

Additional info would help. What kind of database do you want to import the file to?


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top