• SqlBulkCopy 简单运用


           using(SqlConnection conn = new SqlConnection(str))
           {
      conn.Open();   
    using (System.Data.SqlClient.SqlBulkCopy sqlBC = new System.Data.SqlClient.SqlBulkCopy(conn))   {   sqlBC.BatchSize = 10000;// 每次提交的数量级
                sqlBC.BulkCopyTimeout = 60;   sqlBC.DestinationTableName = "dbo.Table1";//需要插入的表名   sqlBC.ColumnMappings.Add("ColumnName1OfDt", "Field1OfTable1");
                      sqlBC.ColumnMappings.Add("ColumnName2OfDt", "Field2OfTable1");
      sqlBC.WriteToServer(dt);
    //自定义的 datatable   }   conn.Dispose();
           }
  • 相关阅读:
    个人博客
    个人博客
    5.4
    4.30
    4.29
    4.28
    4.27
    4.26
    4.25
    4.24
  • 原文地址:https://www.cnblogs.com/yipeng-yu/p/3232473.html
Copyright © 2020-2023  润新知