u_common.pas

来自「简单的人事工资管理系统.... 我是想下载源码菜拿来换的...呵呵~~ 」· PAS 代码 · 共 62 行

PAS
62
字号
unit U_Common;

interface

uses Windows, StrUtils, DB, ADODB,Forms,Controls,Dialogs;


type TQueryMethod=(qmOpen,qmExec);
function OpenQuery(Q:TADOQuery;SQL:string;Method:TQueryMethod):Boolean;
function GetPopedomStr(Popedom:Integer):string;

procedure ShowErrorMsgBox(Info:string);
procedure ShowTipMsgBox(Info:string);
function ShowYesNoMsgBox(Info:string):Integer;

implementation


function OpenQuery(Q:TADOQuery;SQL:string;Method:TQueryMethod):Boolean;
begin
   if Q.Active then Q.Close;
   Q.SQL.Clear;
   Q.SQL.Add(SQL);

   if Method=qmOpen then
      Q.Open
   else
      Q.ExecSQL;

   Result:=not Q.IsEmpty;
   //Q.Close;
end;

function GetPopedomStr(Popedom:Integer):string;
begin
  case Popedom of
   0: Result:='系统管理员';
   1: Result:='高级用户' ;
   2: Result:='普通用户' ;
   3: Result:='游客' ;
   else
     Result:='未知';
  end;
end;  

procedure ShowErrorMsgBox(Info:string);
begin
   Application.MessageBox(PAnsiChar(Info),'出错啦!');
end;

procedure ShowTipMsgBox(Info:string);
begin
   MessageDlg(Info, mtInformation,[mbOK],0);
end;

function ShowYesNoMsgBox(Info:string):Integer;
begin
   Result:= MessageDlg(Info, mtInformation,[mbYes,mbNo],0);
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?