CSV to DataTable
Converting Microsoft Excel CSV to .Net DataTable:
After casually browsing the net for some good examples, everything I came across was too bulky or over-kill for what I needed this code for, so I decided to write my own.
The following code snippet is tested and works with .Net 2.0 or later. Please note “handleError()” method which is not defined in code below. This is simply generic static method accepting string and exception types to handle all exceptions in your application in a uniform manner.
The nice thing about this code compared to some other examples you may come across in your searches is that it works stand-alone without any external references or potentially buggy usage/constructors such as OleDB Jet provider.
It’s clean, concise, and to the point. Use it wisely. 😉