SqlBulkCopy 的用法

 string  connectionstring="server=.;uid=sa;pwd=sa;database=test";

SqlBulkCopy sbc = new SqlBulkCopy(Guide.GetConnectionString(SPType.SP_R), SqlBulkCopyOptions.UseInternalTransaction);
            sbc.BulkCopyTimeout = 5000;
            sbc.NotifyAfter = dt.Rows.Count;

            try
            {
                //tb_RealShippingFee   向那张表里面写数据
                sbc.DestinationTableName = "tb_RealShippingFee";
                  //dt指 从那个数据源里往指定表写数据
                sbc.WriteToServer(dt);
            }
            catch (Exception ex)
            {

            }

posted @ 2012-11-14 17:46  放哨De老鼠  阅读(241)  评论(0编辑  收藏  举报