varsql=string.Format("update d set d.StatPay_ID = null from B3SheepButcherManage_Butcher_Detail d left outer join B3SheepButcherManage_StatPay m on d.StatPay_ID=m.ID where d.WeightBill_ID={0} and m.ID is null and d.StatPay_ID is not null",wid);
varsql=string.Format("update d set d.StatPay_ID = null from B3SheepButcherManage_Butcher_Detail d left outer join B3SheepButcherManage_StatPay m on d.StatPay_ID=m.ID where d.WeightBill_ID={0} and m.ID ={1} and d.StatPay_ID is not null",wid,statPayID);