KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
This is my code with the following columns and in the DB, those columns are nvarchars . SqlBulkCopy bulkCopy = new SqlBulkCopy(connection, System.Data.SqlClient.SqlBulkCopyOptions.Default, transaction); bulkCopy.DestinationTableName = "Test"; bulkCopy.ColumnMappings.Add("Number", "Code"); bulkCopy.ColumnMappings.Add("Type", "Type"); bulkCopy.ColumnMappings.Add("Group", "Group"); bulkCopy.ColumnMappings.Add("Short Text", "ShortText"); bulkCopy.ColumnMappings.Add("Text", "Description"); bulkCopy.WriteToServer(dataTable); I am trying to insert a whole data table in a DB, using bulk copy but I am getting this error: The given value of type String from the data source cannot be converted to type nvarchar of the specified target column.
Tags (comma-separated)
Save Edits
Cancel