Y
yyss
Unregistered / Unconfirmed
GUEST, unregistred user!
try<br> F_dm.ADOConnection1.BeginTrans; <br> with adoquery1 do<br> begin<br> Close;<br> SQL.Clear;<br> SQL.Add('update tb_bmljzs SET bzrs=(select count(*) from tb_main where danwei=:dw and bzcy=:str),bzzs=(select avg(ljzs) from tb_main where danwei=:dw2 and bzcy=:str2) where danwei=:dw3');<br> parameters.ParamByName('dw').Value:=Trim(edit1.Text);<br> parameters.ParamByName('str').Value:='是';<br> parameters.ParamByName('dw2').Value:=Trim(edit1.Text);<br> parameters.ParamByName('str2').Value:='是';<br> parameters.ParamByName('dw3').Value:=Trim(edit1.Text);<br> ExecSql;<br> Close;<br> SQL.Clear;<br> SQL.Add('update tb_bmljzs SET ljrs=(select count(*) from tb_main where danwei=:dw and ljzs>=8),bjlrs=(select count(*) from tb_main where danwei=:dw2 and (ljzs>=6 and ljzs<8)),blrs=(select count(*) from tb_main where danwei=:dw3 and ljzs<6) where danwei=:dw4');<br> parameters.ParamByName('dw').Value:=Trim(edit1.Text);<br> parameters.ParamByName('dw2').Value:=Trim(edit1.Text);<br> parameters.ParamByName('dw3').Value:=Trim(edit1.Text);<br> parameters.ParamByName('dw4').Value:=Trim(edit1.Text);<br> ExecSql;<br> Close;<br> SQL.Clear;<br> SQL.Add('update tb_bmljzs SET sjrs=(select count(*) from tb_main where danwei=:dw and (ljzs>=7 and ljzs<8)),ejrs=(select count(*) from tb_main where danwei=:dw2 and (ljzs>=6 and ljzs<7)) where danwei=:dw3');<br> parameters.ParamByName('dw').Value:=Trim(edit1.Text);<br> parameters.ParamByName('dw2').Value:=Trim(edit1.Text);<br> parameters.ParamByName('dw3').Value:=Trim(edit1.Text);<br> ExecSql;<br> Close;<br> SQL.Clear;<br> SQL.Add('update tb_bmljzs SET yjrs=(select count(*) from tb_main where danwei=:dw and ljzs<6) where danwei=:dw2');<br> parameters.ParamByName('dw').Value:=Trim(edit1.Text);<br> parameters.ParamByName('dw2').Value:=Trim(edit1.Text);<br> ExecSql;<br> end;<br> F_dm.ADOConnection1.CommitTrans; <br> except<br> F_dm.ADOConnection1.RollbackTrans; <br> end;