how to add column mapping in sqlbulkcopy in c# where column names contains White Space

.net sql sqlbulkcopy

Question

using (SqlBulkCopy sc = new SqlBulkCopy(conn))
{
    sc.DestinationTableName = destination;

    sc.ColumnMappings.Add("ID","ID #");
    sc.ColumnMappings.Add("Amount","Amount in USD");

    sc.WriteToServer(datatable);
}

I am getting error that column dose not match in given columnmapping

Thanks in Advance.

1
1
4/28/2014 9:07:54 AM

Popular Answer

found solution need to add Square brackets around the fields only where the White space involved in column name

1
4/28/2014 9:59:25 AM


Related Questions





Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow