Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / December 2006

Tip: Looking for answers? Try searching our database.

CSV File reading

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sara - 21 Dec 2006 13:37 GMT
Hello There,

Can anybody help me in reading through large csv files size of about
200mb, with 200 columns.

I have tried with streamreader object parsing line by line but its bit
slow, does anybody have a better solution.

I dont want to landup using 3rd party component.

Regards,
Saravanan K
Steve Barnett - 21 Dec 2006 15:57 GMT
I've used this - very easy to use and very fast:
   http://www.codeproject.com/cs/database/CsvReader.asp

It seems to be supported (they fixed a bug for me) and has source if you
want to "mess". Performance wise, they quote:

"To give more down to earth numbers, with a 45 MB CSV file containing 145
fields and 50,000 records, the reader was processing about 30 MB/sec. So all
in all, it took 1.5 seconds! The machine specs were P4 3.0 GHz, 1024 MB."

HTH
Steve

> Hello There,
>
[quoted text clipped - 8 lines]
> Regards,
> Saravanan K
RobinS - 21 Dec 2006 21:40 GMT
> Hello There,
>
[quoted text clipped - 8 lines]
> Regards,
> Saravanan K

Assuming each line has a carriage-return/line-feed at the end
(and it must, or readLine wouldn't work), here's an easy way
to read in a file and split the lines by Crlf into an array
in one fell swoop. I don't know what this would do with your
file, but it's free to try it. :-)

Dim crlfs() as String = {ControlChars.CrLf}
Dim lines() as String = _
 File.ReadAllText("c:\data.txt").Split(crlfs, StringSplitOptions.None)
Dim numOfLines = lines.Length

Thanks to Francesco Balena; I got this out
of one of his books, probably the VB2005 Core Reference.

Robin S.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.