[BulkInsert] The given ColumnMapping does not match up with any column in the source

Forge Component
(22)
Published on 2019-10-02 by Galter
22 votes
Published on 2019-10-02 by Galter

Hi all,

I'm using the BulkInsert component in my application. 

Basically, I have an entity and a list of records of the entity type. I'm doing a BulkInsert of the list records to the entity. I'm using an aggregate to get the physical entity name to pass to the BulkInsert action. In my personal area, the same piece of code is working fine (only with different entities) and in another environment is giving me this error:

BulkInsert: System.InvalidOperationException: The given ColumnMapping does not match up with any column in the source or destination.
at System.Data.SqlClient.SqlBulkCopy.AnalyzeTargetAndCreateUpdateBulkCommand(BulkCopySimpleResultSet internalResults)
at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestContinuedAsync(BulkCopySimpleResultSet internalResults, CancellationToken cts, TaskCompletionSource`1 source)
at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestAsync(CancellationToken cts, TaskCompletionSource`1 source)
at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalAsync(CancellationToken ctoken)
at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServerAsync(Int32 columnCount, CancellationToken ctoken)
at System.Data.SqlClient.SqlBulkCopy.WriteToServer(DataTable table, DataRowState rowState)
   at OutSystems.NssBulkInsert.CssBulkInsert.SqlServerBulkInsert(IOSList recordList, String tableName, String columnsToIgnore, String referenceColumns, Boolean useTableLock, Dictionary`2 recordFields, String Catalog, String ExternalDatabaseConnectionName)
 

Any help?

Thanks!


Hi Bruno,

The error message "The given ColumnMapping does not match up with any column in the source or destination" occurs if :-

  • the ColumnMappings are incorrect
  • you provided an invalid column name for the source or the destination
  • there is more column in the source than in the destination

Do check

  • to provide a correct ColumnMappings
  • all values in the source and destination column name are valid and case sensitive.

Regards,

Swatantra

Swatantra Kumar wrote:

Hi Bruno,

The error message "The given ColumnMapping does not match up with any column in the source or destination" occurs if :-

  • the ColumnMappings are incorrect
  • you provided an invalid column name for the source or the destination
  • there is more column in the source than in the destination

Do check

  • to provide a correct ColumnMappings
  • all values in the source and destination column name are valid and case sensitive.

Regards,

Swatantra

 Hi Kumar, 

I find the extension will have the problem if the DB field name starts with a numeric prefix.


 It will show: 


As the DB is from my client, I would not rename it. 

Is there any solution to fix it ?

Many Thanks, 

Jayson