Import csv file into SQL Server database in C# Windows application without header

后端 未结 2 942
小蘑菇
小蘑菇 2021-01-26 04:46

I am trying to import a .csv file into a SQL Server database without the headers.

This code works fine, but with headers - how can skip the headers? What do

2条回答
  •  时光说笑
    2021-01-26 04:54

    Just ignore the headers when you read the data from the file. Delete these lines:

    string[] headerColumns = header.Split(',');
    
    foreach (string headerColumn in headerColumns)
    {
        importedData.Columns.Add(headerColumn);
    }
    

提交回复
热议问题