Ekrem Tapan

Ekrem Tapan

  • NA
  • 967
  • 80.9k

split row problem when i cvs file import to mssql

Oct 28 2015 1:49 AM
hi everyone, 
 
i want to ask,  how can i split cvs file when i import to mssql 
 
my code is here
 
string csvData = File.ReadAllText(csvPath);
foreach (string row in csvData.Split('\n'))
{
if (!string.IsNullOrEmpty(row))
{
dt.Rows.Add();
int i = 0;
foreach (string cell in row.Split(','))
{
dt.Rows[dt.Rows.Count-1][i] = cell;
i++;
}
}
}
 
but my cvs file hava a this line
 
XXX","XXX","04011","XX","XX","XX, YY","N039","S040","A","20141003 18:54","20141003 20:18","20141003 23:18" 
 
when importto red part my code is after , move to another cell  
 

Answers (5)