By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,029 Members | 1,330 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,029 IT Pros & Developers. It's quick & easy.

Open a CSV file

P: n/a
Hi,

I've exported our Exchange 5.5 server info into a CSV file. I know want to
create a VB.Net application which reads the CSV file and then process the
information in it.

Can anyone tell me what I should do to create the application. The file is
called info.csv.
And I want to process it row by row.

Kind Regards

Stefke
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi Stefke,

dim SR as New StreamReader("c:\My Documents\info.csv")
dim txtLine as String
dim Strings as String()
txtLine = SR.ReadLine()
Strings()=String.Split(",",txtLine)
"Stefke" <sf***@tiscali.be> wrote in message
news:Ow**************@TK2MSFTNGP14.phx.gbl...
Hi,

I've exported our Exchange 5.5 server info into a CSV file. I know want to create a VB.Net application which reads the CSV file and then process the
information in it.

Can anyone tell me what I should do to create the application. The file is called info.csv.
And I want to process it row by row.

Kind Regards

Stefke

Nov 21 '05 #2

P: n/a
"Stefke" <sf***@tiscali.be> schrieb:
I've exported our Exchange 5.5 server info into a CSV file. I know want
to
create a VB.Net application which reads the CSV file and then process the
information in it.

Can anyone tell me what I should do to create the application. The file
is
called info.csv.
And I want to process it row by row.


<URL:http://www.connectionstrings.com/>
-> "Text"

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

P: n/a
Stefke,

\\\
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:\Test1\"
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
DataGrid1.DataSource = ds.Tables(0)
End Sub
///

I hope this helps a little bit?

Cor
Nov 21 '05 #4

P: n/a
It should be noted that whilst this would "normally" work, it will fail if
the data contacts a comma ... eg

"hello","this has a comma, see!!",100

You would need to parse the string looking for opening and closing quotation
marks and taking commas between them as part of the data and not a
delimiter.

Herfried and Cor's suggestion for using the text connection string would do
this for you...

Regards
Simon
"Pipo" <Pi**@nobody.com> wrote in message
news:eN**************@tk2msftngp13.phx.gbl...
Hi Stefke,

dim SR as New StreamReader("c:\My Documents\info.csv")
dim txtLine as String
dim Strings as String()
txtLine = SR.ReadLine()
Strings()=String.Split(",",txtLine)
"Stefke" <sf***@tiscali.be> wrote in message
news:Ow**************@TK2MSFTNGP14.phx.gbl...
Hi,

I've exported our Exchange 5.5 server info into a CSV file. I know want

to
create a VB.Net application which reads the CSV file and then process the
information in it.

Can anyone tell me what I should do to create the application. The file

is
called info.csv.
And I want to process it row by row.

Kind Regards

Stefke


Nov 21 '05 #5

P: n/a
The benchmarks of processing csv files using the microsoft drivers are
not very good.

http://www.codeproject.com/cs/database/CsvReader.asp
http://www.geocities.com/shriop/csv_benchmarks.html

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.