I\'m working on a project and I need to read a CSV file and then fill a DataSet with its data. I\'ve been searching and I have found some interesting things in OleDB.
if nothing special i use this kind of code
TextReader tr1 = new StreamReader(@"c:\pathtofile\filename",true);
var Data = tr1.ReadToEnd().Split('\n')
.Where(l=>l.Length>0) //nonempty strings
.Skip(1) // skip header
.Select(s=>s.Trim()) // delete whitespace
.Select(l=>l.Split(',')) // get arrays of values
.Select(l=>new {Field1=l[0],Field2=l[1],Field3=l[2]});