String Strsql1 = "UPDATE b SET iUnitCost=c.单价,iPrice=round(iQuantity*c.单价,2) from RdRecord a inner join RdRecords b on a.id=b.id INNER JOIN (select a.cBusCode as 业务号,b.cInvCode as 产品编码,b.iUnitCost as 单价 from RdRecord a left join RdRecords b on a.id=b.id where (a.dDate>='" + startTime.Text + "'and a.dDate<='" + endTime.Text + "')and a.cBusType ='转换出库' and (not b.iUnitCost is null and b.iunitcost<>0)) AS c ON c.业务号=a.cBusCode where (a.dDate>='" + startTime.Text + "'and a.dDate<='" + endTime.Text + "') and a.cBusType ='转换入库'and a.cRdCode='" + DropDownList2.Text + "' and a.cWhCode='" + whcode2.Text + "' and (b.iUnitcost is null or b.iunitcost=0)"; SqlCommand cmd = new SqlCommand(Strsql1, Conn); Conn.Open();