Can anyone tell me how to add data using excel data with 3 columns into database table that has 9 columns.
I'm using this tutorial to bulk my data.
FYI: I'm totally newbie
Thanks & Regards
Hi,
You need to map the Column name link below as Given in article
sqlBulkCopy.ColumnMappings.Add("Id", "PersonId") sqlBulkCopy.ColumnMappings.Add("Name", "Name") sqlBulkCopy.ColumnMappings.Add("Salary", "Salary")
I hope this will help you out.
I did that, but when I debug the code it shows error something like the destination table and source table are not match up.
FYI: My excel columns are 3 and my sql table columns are 8(so I think it's because of that)
Make sure that all other column must be nullable for which you are not passing value or they must have default constraint
I found the issue, it seems that I misstype the column name.
@Shshikant: thanks for your attantion and help :)
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.