c# - SqlBulkCopy with Byte[] DataTable column error -
I have a strongly inserted dataset with a datat with one of the columns in the form of a byte [] column. Enter a binary (4) database table field I am able to set the byte [] column values without any problems, but when I run sqlbulkcopy on the data cable, I get the following exception:
"32 types of data source can be given specified target calls In has been converted into a binary type. "
Detaatbl is a large dataset and Skelblkikopi dataset and [byte with the database table] / binary (4) works fine with the column. The following is the code that I have inserted which is using SqlBulkCopy on .NET 2.0.
byte [] codeByteArray = GetByteArray (); Dt.byteArrayCol = codeByteArray; ... use (SqlBulkCopy BC = new SqlBulkCopy (conn)) {bc.DestinationTableName = dt.TableName; Bc.WriteToServer (DT); Bc.Close (); }
I have searched my problem byte [column] in my data labels equally In the situation the corresponding database column was not sorted. The datatable column was 56, while the database column was 8 in sequence, thus either the need to reconstruct the dataset or columnmapping for the Clabblakcopy. Arranging the data was very easy and fast.
Comments
Post a Comment