[BulkInsert] BulkInsert - Binary Field

Forge Component
Published on 2018-11-10 by João Pedro Abreu
13 votes
Published on 2018-11-10 by João Pedro Abreu

Hello, I'm trying to use BulkInsert onto a table with a Binary field, currently I running a SQLServer DB, but I get the follow error when doing the insert:

The given value of type String from the data source cannot be converted to type varbinary of the specified target column.

Any ideas?

You are trying to insert a field of type string into a binary field


Hum... no actualy I'm not.

Searching a bit more around the error and the classes used on the xif I founded this: https://stackoverflow.com/questions/2001715/how-can-i-use-sqlbulkcopy-with-binary-data-byte-in-a-datatable

Adding a if to verify if the type I'm passing is an array of bytes and forcing the field to use it resolved my problem... Whitout it the SqlBulkCopy would treat the field as String giving me the reported error.


Try to edit the extension and replace that particular piece of code to see whats happening