I'm trying to mass-insert a CSV file into a SQL Server database.
The process is .CSV files DataTable for SqlBulkCopy SQL Server.
In the file I have several NULL
that this code returns as text, and should not be text:
var linea = line.Split(delimiter);
row = dt.NewRow();
for (j = 0; j < linea.Length; j++)
{
if (linea[j].ToString().ToLower() == "null")
{
row[j] = DBNull.Value;
}
}
dt.Rows.Add(row);