问题
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:
found solution need to add Square brackets around the fields only where the White space involved in column name
来源:https://stackoverflow.com/questions/23335920/how-to-add-column-mapping-in-sqlbulkcopy-in-c-sharp-where-column-names-contains