Unable to compare the columns in SqlBulkCopy

后端 未结 1 1622
别那么骄傲
别那么骄傲 2021-01-25 20:26

Here is my code:

 protected void Button1_Click(object sender, EventArgs e)
 {
    string strFileType = System.IO.Path.GetExtension(FileUpload1.FileName).ToString         


        
相关标签:
1条回答
  • 2021-01-25 20:44

    The column mappings are to be added to the bulkCopy.ColumnsMappings collection:

    var mapping1 = new SqlBulkCopyColumnMapping("id", "ida");
    bulkCopy.ColumnMappings.Add(mapping1);
    

    You do the mapping before you execute the WriteToServer call.

    The MSDN documentation of SqlBulkCopyColumnMapping has further documentation and an example.

    0 讨论(0)
提交回复
热议问题