procedure TfrmGroups.itmDeleteClick(Sender: TObject);
var
strsql,selGroup:string;
begin
selGroup:=TV.Selected.Text;
if (selGroup='系统用户组') or (selGroup='') then exit;
{判断是否有用户已经属于该用户组}
strsql := 'select Count(gId) As RecCount';
strsql := strsql + ' from Users';
strsql := strsql + ' where gId='+ lblgId.Caption +'';
RunSQL(dm.QryTmp,strsql);
if dm.QryTmp.FieldByName('RecCount').Value >0 then begin
ShowInfo('已经有用户属于该组,不能删除!');
exit;
end;
ShowWarnInfo('你确定要删除该用户组!');
strsql:='Delete From Groups Where gId='+ lblgId.Caption +'';
RunSQL(dm.Groups,strsql);
TV.Selected.Delete;
end;