MySqlConnector有个MySqlBulkCopy批量新增数据方法,不过只能用DataTable,需要把list转成DataTable代码如下:
MySqlBulkCopy mySqlBulkCopy = new MySqlBulkCopy(conn) { DestinationTableName = "userinfo" }; mySqlBulkCopy.ColumnMappings.AddRange(table.Columns.Cast<DataColumn>().Select(colum => new MySqlBulkCopyColumnMapping { DestinationColumn = colum.ColumnName, SourceOrdinal = colum.Ordinal }).ToList()); mySqlBulkCopy.WriteToServer(table);
标签:mySqlBulkCopy,colum,批量,新增,MySqlBulkCopy,new,table From: https://www.cnblogs.com/runningprogrammer/p/MySqlBulkCopy.html