📄 unit3.~pas
字号:
unit Unit3;
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;
Table1: TTable;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
Bevel1: TBevel;
StaticText1: TStaticText;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
RadioButton5: TRadioButton;
RadioButton6: TRadioButton;
Bevel2: TBevel;
SpeedButton1: TSpeedButton;
Memo1: TMemo;
Edit1: TEdit;
Label2: TLabel;
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure RadioButton3Click(Sender: TObject);
procedure RadioButton4Click(Sender: TObject);
procedure RadioButton5Click(Sender: TObject);
procedure RadioButton6Click(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.RadioButton6Click(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
enablecontrols;
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -