czhixingchaxun.txt

来自「一个程序而已」· 文本 代码 · 共 96 行

TXT
96
字号

执行查询事件源程序CZhixingChaxun.pas

unit CZhixingChaxun;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, DBCtrls, Grids, DBGrids, DB, DBTables,
  Buttons;
type
  TForm3 = class(TForm)
    Label1: TLabel;
    StaticText1: TStaticText;
    Bevel1: TBevel;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    RadioButton4: TRadioButton;
    RadioButton5: TRadioButton;
    Bevel2: TBevel;
    Memo1: TMemo;
    Label2: TLabel;
    Edit1: TEdit;
    DataSource1: TDataSource;
    Table1: TTable;
    DBGrid1: TDBGrid;
    DBNavigator1: TDBNavigator;
    SpeedButton1: TSpeedButton;
    procedure RadioButton1Click(Sender: TObject);
    procedure RadioButton2Click(Sender: TObject);
    procedure RadioButton3Click(Sender: TObject);
    procedure RadioButton4Click(Sender: TObject);
    procedure RadioButton5Click(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form3: TForm3;
implementation
{$R *.dfm}
procedure TForm3.RadioButton1Click(Sender: TObject);
begin
memo1.Text:='学号';
end;
procedure TForm3.RadioButton2Click(Sender: TObject);
begin
memo1.Text:='姓名';
end;
procedure TForm3.RadioButton3Click(Sender: TObject);
begin
memo1.Text:='系别';
end;
procedure TForm3.RadioButton4Click(Sender: TObject);
begin
memo1.Text:='专业';
end;
procedure TForm3.RadioButton5Click(Sender: TObject);
begin
memo1.Text:='性别';
end;
procedure TForm3.SpeedButton1Click(Sender: TObject);
begin
table1.Refresh;
with table1 do
try
disablecontrols;
filtered:false;
memo1.Text:memo1.Text+''''+edit1.Text+'''';
filter:=memo1.Text;
filtered:=true;
finally
enabecontrols;
if table1.recordCount=0 then begin
messagebeep(1);
showmessage('没查到,请检查条件或放弃查询‘);
if messageDlg('是否继续查询?,注意:只有结束查询才可以做其他操作!',
mtinformation,[mbYes,mbNo],0)=mrno then begin
filtered:=false;
table1.close;
table1.open;end;
end else begin
if messageDlg('是否继续查询?,注意:只有结束查询才可以做其他操作!',
mtinformation,[mbYes,mbNo,0)=mrno then begin
filtered:=false;
table1.Close;
table1.Open;
end;
end;
end;
end;
end.

⌨️ 快捷键说明

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