标签:
1 //自增列重新生成:SqlBulkCopy bc = new SqlBulkCopy(conn)
2 //自增列保留原值:SqlBulkCopy bc = new SqlBulkCopy(conn,SqlBulkCopyOptions.KeepIdentity) 3 using(SqlBulkCopy sbc = new SqlBulkCopy(conn,SqlBulkCopyOptions.KeepIdentity)) 4 { 5 sbc.DestinationTableName = tableName; 6 foreach (string col in colList) 7 { 8 sbc.ColumnMappings.Add(col, col); 9 } 10 sbc.BulkCopyTimeout = 0; 11 sbc.WriteToServer(dt); 12 }
标签:
原文地址:http://www.cnblogs.com/liverpool/p/4718312.html