473,385 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Open a CSV file

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
5 13731
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
"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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Stephen | last post by:
could someone give me some advise on a problem I have. At present i have a web application which displays pdf files in a web browser using javascript and the window.open method and pointing to a...
2
by: gary smith | last post by:
I am trying to open a file (file --> open --> file) at an FTP location using visual Studio.net. Unfortunately, I get an "unspecified error" alert whenever I select a file. Can anyone help...
3
by: Murasama | last post by:
Hi there, Im trying a simple file IO operation in Visual Studio .NET 2003 and it can't seem to open the file. If I run the exe in the debug directory it works fine but if I click the start...
6
by: Charles Morrall | last post by:
I have no experience with DB2 as such, but I've been tasked with configuring backup of a server running DB2 v8 on Windows Server 2003. I do have some experience with backups in general though. The...
2
by: nissiml | last post by:
hi, i'm trying to open a asp.net web page that list files from a Windows application like winword and select a file from it . what do i have to do to make it happen, is it simple ? Thanks in...
2
by: Mattbooty | last post by:
Hello, Not sure if anyone else has seen this bug, but I have a form where the entire form is covered with a picturebox. The picturebox has a mouseup event. I also have an open file dialog for...
2
by: agphoto | last post by:
There is big or problem in open file in read and write mode.. $file = "data.txt"; $fp = fopen($file,"w+"); $line = fgets($fp,"120"); // i need only 1st line to read and upto 120 bytes echo...
4
by: DyslexicAnaboko | last post by:
Hello, I have a module that is part of larger project that is giving me trouble, so I setup an example. Brief ===== I simply want to open a text file and make the contents avaliable...
5
by: Ryan Liu | last post by:
Hi, Both way works, I'd just ask some experts which way is better? My application creates a log file daily. Now each time when I write a log, I will open the file and append to the end....
18
by: Coffee Pot | last post by:
Thanks for any advice. ~ CP
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.