您的位置:首页 > 其它

显示部门下的所有员工

2008-12-19 16:09 218 查看
Code

  Procedure ShowDeptUsers;

   var s,aDept:String;

   aSqlQuery:TSqlQuery;

  begin

    s:='';

    aDept:=DBComboBoxEh_Dept.value;

    aSQLQuery:=TSQLQuery.Create(nil);

    with aSQLQuery do try

      Close;SQL.Clear;

      SQLConnection:=SQLConn;

      SQL.Add('Select USERID,UserName from users');

      SQL.Add('where SysID=:SysID ');

      ParamByName('SysID').AsInteger:=GetSysID;

      Open;

      First;

      while not Eof do begin

        if  UserHaveGroupByNo(FSysID, FieldbyName('UserID').AsInteger, gkDept, aDept) then begin

            s:=s+FieldbyName('UserName').AsString;

            if not Eof then  s:=s+',';

        end;

        Next;

      end;

       if RightStr(s,1)=',' then s:=copy(s,1,length(s)-1)

       showmessage('这个部门下有以下登陆用户:'+s)

    finally

      Free;

    end;

  end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐