string sqlInsert = "insert into YJ_YEWU(BGBH,BGFS,JYLX,CPMC,GGXH,YPPH,ZCSB,CPDJ,YPSL,SCRQ,CYJS,CPZL,RWLY,HZBS,SJDW_DWMC,SJDW_LXDZ,";
sqlInsert += "SJDW_LXR,SJDW_LXDH,SJDW_YZBM,SCDW_DWMC,SCDW_LXDZ,SCDW_LXR,SCDW_LXDH,SCDW_YZBM,WTDW_DWMC,WTDW_LXDZ,WTDW_LXR,WTDW_LXDH,";
sqlInsert += "WTDW_YZBM,JYBZ,WTTSYQ,SYR,SYRDH,SYRQ,CYR,CYRQ,CYDD,JCFYRY,CYDH,FYZT,YPCLFS,UserName,JYXM,JYSM,JYJL,JYJLTRUE,SJDW_ID,";
sqlInsert += " SCDW_ID,WTDW_ID,BYSL,BYDD,BaseName)";
sqlInsert += "(select BGBH,BGFS,JYLX,CPMC,GGXH,YPPH,ZCSB,CPDJ,YPSL,SCRQ,CYJS,CPZL,RWLY,HZBS,SJDW_DWMC,SJDW_LXDZ,";
sqlInsert += "SJDW_LXR,SJDW_LXDH,SJDW_YZBM,SCDW_DWMC,SCDW_LXDZ,SCDW_LXR,SCDW_LXDH,SCDW_YZBM,WTDW_DWMC,WTDW_LXDZ,WTDW_LXR,WTDW_LXDH,";
sqlInsert += "WTDW_YZBM,JYBZ,WTTSYQ,SYR,SYRDH,SYRQ,CYR,CYRQ,CYDD,JCFYRY,CYDH,FYZT,YPCLFS,UserName,JYXM,JYSM,JYJL,JYJLTRUE,SJDW_ID,";
sqlInsert += " SCDW_ID,WTDW_ID,BYSL,BYDD,BaseName from Temp_YEWU where YEWUID='" + TempYEWUID + "')select @@identity";
myConn.Open();
myCmd = new SqlCommand(sqlInsert, myConn);
newYEWUID = Int64.Parse(myCmd.ExecuteScalar().ToString()); //取得新插入记录的ID值
myConn.Close();
string sqlUpdate = "update Temp_YEWUXM set YEWUID=" + newYEWUID + " where YEWUID=" + TempYEWUID;
myConn.Open();
myCmd = new SqlCommand(sqlUpdate,myConn);
myCmd.ExecuteNonQuery();
myConn.Close();