string path = @"C:Userskeen_DownloadsuploaduploadUpload20140701141934_export.csv"; ImportDataTable(path); //2014-07-01 //get csv file to datatable private static DataTable ImportDataTable(string filepath) { DataTable mydt = new DataTable("myTableName"); mydt.Columns.Add("Data ID", System.Type.GetType("System.String")); mydt.Columns.Add("Field Name", System.Type.GetType("System.String")); mydt.Columns.Add("New Value", System.Type.GetType("System.String")); DataRow mydr; using (System.IO.StreamReader mysr = new System.IO.StreamReader(filepath)) { int data; char current; StringBuilder text = new StringBuilder(); IDictionary<int, List<string>> results = new Dictionary<int, List<string>>(); bool isInYinHao = false; ; int lineId = 1; int index = 0; while (true) { data = mysr.Read(); if (data != -1) { current = (char)data; if (current == '"') { if (isInYinHao) { isInYinHao = false; } else { if (index > 0) { text.Append(current); } isInYinHao = true; } } else if (current == ',') { if (isInYinHao) { text.Append(current); } else { SaveResult(results, lineId, text); index = 0; continue; } } else if (current == ' ') { if (isInYinHao) { text.Append(current); } } else if (current == ' ') { if (isInYinHao) { text.Append(current); } else { SaveResult(results, lineId, text); index = 0; lineId++; continue; } } else if (current == '