private OperationResult BulkInsert(DataTable internalTable, int timeOut = 20000, string connectionStringName = "BaseContext") { using (var connection = new BaseDatabase(connectionStringName, timeOut).Connection) { var bulkSql = new SqlBulkCopy ( connection, SqlBulkCopyOptions.TableLock | SqlBulkCopyOptions.FireTriggers, null ); try { bulkSql.DestinationTableName = internalTable.TableName; bulkSql.BulkCopyTimeout = timeOut; foreach (DataColumn coluna in internalTable.Columns) { if ((coluna.Table.TableName == "ExtraCards" || coluna.Table.TableName == "OrderItems" || coluna.Table.TableName == "OrderItemsDeleted") && (coluna.Caption == "Monthly" || coluna.Caption == "Formatting")) { continue; } bulkSql.ColumnMappings.Add(coluna.ColumnName, coluna.ColumnName); } connection.Open(); bulkSql.WriteToServer(internalTable); connection.Close(); return(new OperationResult()); } catch (Exception ex) { return(new OperationResult(false, ex.Message)); } } }