Having trouble with Microsoft Text Driver? Here’s a solution!

Posted: June 15, 2008 in Uncategorized
I ported the OpenCSV project (opencsv.sourceforge.net) to the .NET Framework. This version is read-only, although if you want a writer, let me know. Unlike OpenCSV, OpenCSV# returns a datatable, so you can simply pass in a CSV filename and it will be parsed and returned in a form that’s bindable!

You can download the DLL and the source at: http://aurigroup.com/downloads/OpenCSVSharp.zip

So why not use the Microsoft Text Driver? Well, Microsoft’s Text Driver doesn’t work on Microsoft’s 64-bit operating systems! Necessity is the mother of all invention, and therefore I’m releasing my port of OpenCSV for all .NET users to enjoy 🙂

Also unlike OpenCSV, OpenCSV# support setting whether the first row of data is the column headers, and automatically populates the column names so you don’t have to work with index values and potentially wrong data.

Technical details:

* Written in C# instead of Java.
* Written for .NET Framework 2.0 and above.
* Made the ParseLine() function public so you can just pass a string and parse it, in case you don’t want to parse an entire file. I haven’t tested the ParseLine direct call, fyi.

Enjoy!

Auri Rahimzadeh
President, The Auri Group, LLC (TAG, http://www.aurigroup.com)
Contributor, ASP.NET Pro Magazine, Consultants Corner (yep, I do that column)
Author, Hacking the PSP, Geek My Ride
Technical Editor, Building Web Sites Bible 3rd Edition, Beginning Access 2007 VBA

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s