⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ufindemployee.pas

📁 说明: 比较简单的人事档案管理程序,包含了人事档案的大部分功能,做人事档案的兄弟可以看看. 本程序类型:delphi7 + Access2000 桌面数据库 初始用户名/密码:admin
💻 PAS
字号:
unit UFindEmployee;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Buttons, StdCtrls;

type
  TForm_FindEmployee = class(TForm)
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    Edit1: TEdit;
    SpeedButton1: TSpeedButton;
    procedure RadioButton1Click(Sender: TObject);
    procedure RadioButton2Click(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form_FindEmployee: TForm_FindEmployee;

implementation
uses Umain;
{$R *.dfm}

procedure TForm_FindEmployee.RadioButton1Click(Sender: TObject);
begin
  edit1.Enabled := true;
  edit1.SetFocus;
end;

procedure TForm_FindEmployee.RadioButton2Click(Sender: TObject);
begin
  edit1.Enabled := true;
  edit1.SetFocus;
end;

procedure TForm_FindEmployee.SpeedButton1Click(Sender: TObject);
begin
  if trim(edit1.Text) = '' then
    showmessage('请选择查询方式后输入查询内容')
  else
  begin
    if RadioButton1.Checked = true then
    begin
      try
        with Form_Main.ADOQDBGrid do
        begin
          close;
          SQL.Clear;
          SQL.Add('select * from Employee');
          SQL.Add('WHERE Employee_ID=''' + trim(edit1.Text) + '''');
          open;
          Form_Main.label2.Caption := '共找到 ' + inttostr(Form_Main.ADOQDBGrid.RecordCount) + '条符合条件的记录';
          if Form_Main.ADOQDBGrid.RecordCount = 0 then
            showmessage('没找到编号为:' + '' + trim(edit1.Text) + '  ' + '的记录!')
        end;
      except
        showmessage('查询失败');
      end;
      close;
    end;
    if RadioButton2.Checked = true then
    begin
      try
        with Form_Main.ADOQDBGrid do
        begin
          close;
          SQL.Clear;
          SQL.Add('select * from Employee');
          SQL.Add('WHERE Employee_name like''%' + edit1.Text + '%''');
          open;
          Form_Main.label2.Caption := '共找到 ' + inttostr(Form_Main.ADOQDBGrid.RecordCount) + '条符合条件的记录';
          if Form_Main.ADOQDBGrid.RecordCount = 0 then
            showmessage('没找到姓名为:' + '' + edit1.Text + '  ' + '的记录!')
        end;
      except
        showmessage('查询失败');
      end;
      close;
    end;
  end;
end;


procedure TForm_FindEmployee.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if key = #13 then
    SpeedButton1Click(Sender);
end;

end.

⌨️ 快捷键说明

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