📄 unit21.~pas
字号:
unit Unit21;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, DB, ADODB, Buttons;
type
TForm21 = class(TForm)
DataSource1: TDataSource;
ADOQuery1: TADOQuery;
DBGrid1: TDBGrid;
Label1: TLabel;
Label2: TLabel;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
BitBtn1: TBitBtn;
procedure ComboBox1Change(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form21: TForm21;
implementation
uses Unit1, Unit5;
{$R *.dfm}
procedure TForm21.ComboBox1Change(Sender: TObject);
begin
if ComboBox1.ItemIndex=0 then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 室学期教学任务表');
ADOQuery1.SQL.Add('where 学期<>''''');
ADOQuery1.SQL.Add('and 学期=''99-1''');
ADOQuery1.SQL.Add('order by 学期');
ADOQuery1.Open;
if (ADOQuery1.RecordCount=0) then
Application.MessageBox('查找无效,目标可能不存在','警告!',MB_OK);
end;
if ComboBox1.ItemIndex=1 then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 室学期教学任务表');
ADOQuery1.SQL.Add('where 学期<>''''');
ADOQuery1.SQL.Add('and 学期=''99-2''');
ADOQuery1.SQL.Add('order by 学期');
ADOQuery1.Open;
if (ADOQuery1.RecordCount=0) then
Application.MessageBox('查找无效,目标可能不存在','警告!',MB_OK);
end;
if ComboBox1.ItemIndex=2 then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 室学期教学任务表');
ADOQuery1.SQL.Add('where 学期<>''''');
ADOQuery1.SQL.Add('and 学期=''00-1''');
ADOQuery1.SQL.Add('order by 学期');
ADOQuery1.Open;
if (ADOQuery1.RecordCount=0) then
Application.MessageBox('查找无效,目标可能不存在','警告!',MB_OK);
end;
if ComboBox1.ItemIndex=3 then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 室学期教学任务表');
ADOQuery1.SQL.Add('where 学期<>''''');
ADOQuery1.SQL.Add('and 学期=''00-2''');
ADOQuery1.SQL.Add('order by 学期');
ADOQuery1.Open;
if (ADOQuery1.RecordCount=0) then
Application.MessageBox('查找无效,目标可能不存在','警告!',MB_OK);
end;
if ComboBox1.ItemIndex=4 then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 室学期教学任务表');
ADOQuery1.SQL.Add('where 学期<>''''');
ADOQuery1.SQL.Add('and 学期=''01-1''');
ADOQuery1.SQL.Add('order by 学期');
ADOQuery1.Open;
if (ADOQuery1.RecordCount=0) then
Application.MessageBox('查找无效,目标可能不存在','警告!',MB_OK);
end;
if ComboBox1.ItemIndex=5 then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 室学期教学任务表');
ADOQuery1.SQL.Add('where 学期<>''''');
ADOQuery1.SQL.Add('and 学期=''01-2''');
ADOQuery1.SQL.Add('order by 学期');
ADOQuery1.Open;
if (ADOQuery1.RecordCount=0) then
Application.MessageBox('查找无效,目标可能不存在','警告!',MB_OK);
end;
if ComboBox1.ItemIndex=6 then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 室学期教学任务表');
ADOQuery1.SQL.Add('where 学期<>''''');
ADOQuery1.SQL.Add('and 学期=''02-1''');
ADOQuery1.SQL.Add('order by 学期');
ADOQuery1.Open;
if (ADOQuery1.RecordCount=0) then
Application.MessageBox('查找无效,目标可能不存在','警告!',MB_OK);
end;
if ComboBox1.ItemIndex=7 then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 室学期教学任务表');
ADOQuery1.SQL.Add('where 学期<>''''');
ADOQuery1.SQL.Add('and 学期=''02-2''');
ADOQuery1.SQL.Add('order by 学期');
ADOQuery1.Open;
if (ADOQuery1.RecordCount=0) then
Application.MessageBox('查找无效,目标可能不存在','警告!',MB_OK);
end;
end;
procedure TForm21.ComboBox2Change(Sender: TObject);
begin
if ComboBox2.ItemIndex=0 then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 室学期教学任务表');
ADOQuery1.SQL.Add('where 教师姓名<>''''');
ADOQuery1.SQL.Add('and 教师姓名=''czy''');
ADOQuery1.SQL.Add('order by 学期');
ADOQuery1.Open;
if (ADOQuery1.RecordCount=0) then
Application.MessageBox('查找无效,目标可能不存在','警告!',MB_OK);
end;
if ComboBox2.ItemIndex=1 then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 室学期教学任务表');
ADOQuery1.SQL.Add('where 教师姓名<>''''');
ADOQuery1.SQL.Add('and 教师姓名=''drs''');
ADOQuery1.SQL.Add('order by 学期');
ADOQuery1.Open;
if (ADOQuery1.RecordCount=0) then
Application.MessageBox('查找无效,目标可能不存在','警告!',MB_OK);
end;
if ComboBox2.ItemIndex=2 then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 室学期教学任务表');
ADOQuery1.SQL.Add('where 教师姓名<>''''');
ADOQuery1.SQL.Add('and 教师姓名=''mjw''');
ADOQuery1.SQL.Add('order by 学期');
ADOQuery1.Open;
if (ADOQuery1.RecordCount=0) then
Application.MessageBox('查找无效,目标可能不存在','警告!',MB_OK);
end;
if ComboBox2.ItemIndex=3 then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 室学期教学任务表');
ADOQuery1.SQL.Add('where 教师姓名<>''''');
ADOQuery1.SQL.Add('and 教师姓名=''zp''');
ADOQuery1.SQL.Add('order by 学期');
ADOQuery1.Open;
if (ADOQuery1.RecordCount=0) then
Application.MessageBox('查找无效,目标可能不存在','警告!',MB_OK);
end;
if ComboBox2.ItemIndex=4 then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 室学期教学任务表');
ADOQuery1.SQL.Add('where 教师姓名<>''''');
ADOQuery1.SQL.Add('and 教师姓名=''zy''');
ADOQuery1.SQL.Add('order by 学期');
ADOQuery1.Open;
if (ADOQuery1.RecordCount=0) then
Application.MessageBox('查找无效,目标可能不存在','警告!',MB_OK);
end;
end;
procedure TForm21.BitBtn1Click(Sender: TObject);
begin
form5.Show;
form21.Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -