I use this code to send a SQL request:
SqlBulkCopy bulkCopy = new SqlBulkCopy(Connection);
foreach (DataColumn column in dt.Columns)
{
bulkCopy.ColumnMappings.Add(column.ColumnName, column.ColumnName);
}
bulkCopy.DestinationTableName = "nsi." + classifierData.Info.TableName;
bulkCopy.WriteToServer(dt);
and get this exception :
Received an invalid column length from the bcp client for colid
Is there any way to identify which row is causing the error?
I've tried to use this, but it doesn't work (values are always the same):
FieldInfo currentRow = typeof(SqlBulkCopy).GetField("_currentRowLength", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance);
var currentRowNumber = currentRow.GetValue(bulkCopy);
FieldInfo _rowsCopiedField = typeof(SqlBulkCopy).GetField("_rowsCopied", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance);
var currentRowN = _rowsCopiedField.GetValue(bulkCopy);
Please, help me anyone ...