• DataTable 2 Sql Table


            public void ExecuteDataTable2Table(DataTable dt,string tbName)
            {
                SqlBulkCopy sbc = new SqlBulkCopy(conn);
                sbc.DestinationTableName = tbName;
                DataTable dtFields = this.ExecuteDataTable("select * from dictionary_V where pcode='" + tbName + "_Fields'");
                string guid = Guid.NewGuid().ToString();
                dt.Columns.Add(new DataColumn("GUIDStr"));
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dt.Rows[i]["GUIDStr"] = guid;
                }
                for (int i = 0; i < dtFields.Rows.Count; i++)
                {
                    sbc.ColumnMappings.Add(new SqlBulkCopyColumnMapping(dtFields.Rows[i]["name"].ToString(), dtFields.Rows[i]["code"].ToString()));   
                }
    
                sbc.ColumnMappings.Add(new SqlBulkCopyColumnMapping("GUIDStr", "GUID"));
                sbc.WriteToServer(dt);
            }
    
  • 相关阅读:
    定制可引导的iso镜像
    镜像封装
    nginx知识及nginx集群搭建
    注册系统服务
    安装pip
    获取硬件信息
    查看网卡信息
    python paramiko模块
    python pexpect模块
    python-nmap的使用
  • 原文地址:https://www.cnblogs.com/skyakira/p/2963905.html
Copyright © 2020-2023  润新知