CSV File Imports in .Net [closed]

By : MattH
Source: Stackoverflow.com

I realize this is a newbie question, but I'm looking for a simple solution - it seems like there should be one.

What's the best way to import a CSV file into a strongly-typed data structure? Again simple = better.

By : MattH


A good simple way to do it is to open the file, and read each line into an array, linked list, data-structure-of-your-choice. Be careful about handling the first line though.

This may be over your head, but there seems to be a direct way to access them as well using a connection string.

Why not try using Python instead of C# or VB? It has a nice CSV module to import that does all the heavy lifting for you.

There are two articles on CodeProject that provide code for a solution, one that uses StreamReader and one that imports CSV data using the Microsoft Text Driver.

This video can help you solving your question :)
By: admin