You can load a CSV file to DataTable.
Sample code -
static DataTable CsvToDataTable(string strFileName)
{
DataTable dataTable = new DataTable("DataTable Name");
using (OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0; Data Source = " + Directory.GetCurrentDirectory() + "; Extended Properties = \"Text;HDR=YES;FMT=Delimited\""))
{
conn.Open();
string strQuery = "SELECT * FROM [" + strFileName + "]";
OleDbDataAdapter adapter =
new System.Data.OleDb.OleDbDataAdapter(strQuery, conn);
adapter.Fill(dataTable);
}
return dataTable;
}
Make sure you compile your project to x86 processor. It doesn't work for x64.