📄 unit20.pas
字号:
unit Unit20;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, Grids, DBGrids, StdCtrls, Buttons;
type
TForm20 = class(TForm)
Label1: TLabel;
Label2: TLabel;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
DBGrid1: TDBGrid;
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
BitBtn1: TBitBtn;
procedure ComboBox1Change(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form20: TForm20;
implementation
uses Unit5, Unit1, Unit6;
{$R *.dfm}
procedure TForm20.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 专业=''计算机科学与技术''');
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 专业=''通信与信息工程系''');
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 专业=''机电与交通工程系''');
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 专业=''设计系''');
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 专业=''管理系''');
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 专业=''外语系''');
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 专业=''计算科学与应用物理系''');
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 专业=''电子工程系''');
ADOQuery1.SQL.Add('order by 学期');
ADOQuery1.Open;
if (ADOQuery1.RecordCount=0) then
Application.MessageBox('查找无效,目标可能不存在','警告!',MB_OK);
end;
end;
procedure TForm20.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 学期=''99-1''');
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 学期=''99-2''');
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 学期=''00-1''');
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 学期=''00-2''');
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 学期=''01-1''');
ADOQuery1.SQL.Add('order by 学期');
ADOQuery1.Open;
if (ADOQuery1.RecordCount=0) then
Application.MessageBox('查找无效,目标可能不存在','警告!',MB_OK);
end;
if ComboBox2.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 ComboBox2.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 ComboBox2.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 TForm20.BitBtn1Click(Sender: TObject);
begin
form5.Show;
form20.Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -