📄 one.~pas
字号:
procedure TForm1.BitBtn10Click(Sender: TObject);
var i:integer;
begin
if (application.MessageBox('确认删除','提示',mb_yesno+MB_ICONASTERISK)=idyes)
then
begin
str_xy:='delete from 学院 where 学院 like '''+ComboBox6.Text+'''';
with adoquery2 do
begin
close;
sql.clear;
sql.add(str_xy);
execsql;
end;
begin
str_xy:='select * from 学院';
one.Form1.ListBox1.Clear;
ComboBox6.Text:='';
with one.Form1.adoquery2 do
begin close;
sql.Clear;
sql.Add(str_xy);
open;
end;
for i:=one.Form1.adoquery2.RecordCount downto 1 do
begin
SsnoSea:= one.Form1.adoquery2.Fields[0].AsString;
one.Form1.ListBox1.Items.Add( SsnoSea);
one.Form1.adoquery2.next;
one.Form1.adoquery2.ExecSQL;
end; //查找学院
end;
showmessage('删除成功')
end;
end;
procedure TForm1.ComboBox6DropDown(Sender: TObject);
var i:integer;
begin
str_xy:='select 学院 from 学院';
combobox6.Clear;
with adoquery2 do
begin close;
sql.Clear;
sql.Add(str_xy);
open;
end;
for i:=adoquery2.RecordCount downto 1 do
begin
SsnoSea:= adoquery2.Fields[0].AsString;
ComboBox6.Items.Add( SsnoSea);
adoquery2.next;
adoquery2.ExecSQL;
end;
end;
procedure TForm1.ComboBox7DropDown(Sender: TObject);
var i:integer;
begin
str_xy:='select 学院 from 学院';
combobox7.Clear;
with adoquery2 do
begin close;
sql.Clear;
sql.Add(str_xy);
open;
end;
for i:=adoquery2.RecordCount downto 1 do
begin
SsnoSea:= adoquery2.Fields[0].AsString;
ComboBox7.Items.Add( SsnoSea);
adoquery2.next;
adoquery2.ExecSQL;
end;
end;
procedure TForm1.ComboBox7Change(Sender: TObject);
var i:integer;
begin
begin
str_xb:='select * from 系别 where 学院 like '''+combobox7.Text+'''';
ListBox2.Clear;
with one.Form1.adoquery2 do
begin close;
sql.Clear;
sql.Add(str_xb);
open;
end;
for i:=one.Form1.adoquery2.RecordCount downto 1 do
begin
SsnoSea:= adoquery2.Fields[0].AsString;
ListBox2.Items.Add( SsnoSea);
adoquery2.next;
adoquery2.ExecSQL;
end;
end; //查找系别
end;
procedure TForm1.BitBtn11Click(Sender: TObject);
var i:integer;
begin
begin
if Edit2.Text=''
then showmessage('专业不能为空')
else
begin
with adoquery2 do
adoquery2.Close;
adoquery2.SQL.Clear;
adoquery2.SQL.Add('insert into 系别 values('''+Edit2.Text+''','''+ComboBox7.Text+''')');
adoquery2.ExecSQL;
showmessage('添加成功');
edit2.Text:='';
end;
begin
str_xb:='select * from 系别 where 学院 like '''+combobox7.Text+'''';
one.Form1.ListBox2.Clear;
with one.Form1.adoquery2 do
begin close;
sql.Clear;
sql.Add(str_xb);
open;
end;
for i:=one.Form1.adoquery2.RecordCount downto 1 do
begin
SsnoSea:= one.Form1.adoquery2.Fields[0].AsString;
one.Form1.ListBox2.Items.Add( SsnoSea);
one.Form1.adoquery2.next;
one.Form1.adoquery2.ExecSQL;
end; //查找学院
end;
end;
end;
procedure TForm1.Edit2Click(Sender: TObject);
begin
if ComboBox7.Text=''
then
showmessage('请选择要添加的学院')
end;
procedure TForm1.ComboBox8DropDown(Sender: TObject);
var i:integer;
begin
str_xy:='select 学院 from 学院';
combobox8.Clear;
ComboBox9.Clear ;
with adoquery2 do
begin close;
sql.Clear;
sql.Add(str_xy);
open;
end;
for i:=adoquery2.RecordCount downto 1 do
begin
SsnoSea:= adoquery2.Fields[0].AsString;
ComboBox8.Items.Add( SsnoSea);
adoquery2.next;
adoquery2.ExecSQL;
end;
end;
procedure TForm1.ComboBox9DropDown(Sender: TObject);
var i:integer;
begin
str_xy:='select * from 系别 where 学院 like '''+ComboBox8.Text+'''';
combobox9.Clear;
with adoquery2 do
begin close;
sql.Clear;
sql.Add(str_xy);
open;
end;
for i:=adoquery2.RecordCount downto 1 do
begin
SsnoSea:= adoquery2.Fields[0].AsString;
ComboBox9.Items.Add( SsnoSea);
adoquery2.next;
adoquery2.ExecSQL;
end;
end;
procedure TForm1.ComboBox9Change(Sender: TObject);
begin
{str_xb:='select * from 系别 where 学院 like '''+combobox8.Text+'''';
ListBox2.Clear;
with one.Form1.adoquery2 do
begin close;
sql.Clear;
sql.Add(str_xb);
open;
end;
for i:=one.Form1.adoquery2.RecordCount downto 1 do
begin
SsnoSea:= adoquery2.Fields[0].AsString;
ListBox2.Items.Add( SsnoSea);
adoquery2.next;
adoquery2.ExecSQL;
end; }
end;
procedure TForm1.ComboBox8Change(Sender: TObject);
var i:integer;
begin
str_xb:='select * from 系别 where 学院 like '''+combobox8.Text+'''';
ListBox2.Clear;
with one.Form1.adoquery2 do
begin close;
sql.Clear;
sql.Add(str_xb);
open;
end;
for i:=one.Form1.adoquery2.RecordCount downto 1 do
begin
SsnoSea:= adoquery2.Fields[0].AsString;
ListBox2.Items.Add( SsnoSea);
adoquery2.next;
adoquery2.ExecSQL;
end;
end; //查找系别
procedure TForm1.BitBtn12Click(Sender: TObject); //删除专业
var i:integer;
begin
if (application.MessageBox('确认删除','提示',mb_yesno+MB_ICONASTERISK)=idyes)
then
begin
str_xy:='delete from 系别 where 系别 like '''+ComboBox9.Text+'''';
with adoquery2 do
begin
close;
sql.clear;
sql.add(str_xy);
execsql;
end;
begin
str_xy:='select * from 系别 where 学院 like '''+combobox8.Text+'''';
one.Form1.ListBox2.Clear;
ComboBox9.Text:='';
with one.Form1.adoquery2 do
begin close;
sql.Clear;
sql.Add(str_xy);
open;
end;
for i:=one.Form1.adoquery2.RecordCount downto 1 do
begin
SsnoSea:= one.Form1.adoquery2.Fields[0].AsString;
one.Form1.ListBox2.Items.Add( SsnoSea);
one.Form1.adoquery2.next;
one.Form1.adoquery2.ExecSQL;
end; //查找学院
showmessage('删除成功')
end;
end;
end;
procedure TForm1.ComboBox11DropDown(Sender: TObject);
var i:integer;
begin
str_xy:='select 学院 from 学院';
combobox11.Clear;
with adoquery2 do
begin close;
sql.Clear;
sql.Add(str_xy);
open;
end;
for i:=adoquery2.RecordCount downto 1 do
begin
SsnoSea:= adoquery2.Fields[0].AsString;
ComboBox11.Items.Add( SsnoSea);
adoquery2.next;
adoquery2.ExecSQL;
end;
end;
procedure TForm1.BitBtn13Click(Sender: TObject);
begin
if edit3.Text=''
then showmessage('姓名不能为空')
else
begin
with adoquery2 do
adoquery2.Close;
adoquery2.SQL.Clear;
adoquery2.SQL.Add('insert into 教师 values('''+Edit3.Text+''','''+ComboBox10.Text+''','''+ComboBox11.Text+''')');
adoquery2.ExecSQL;
showmessage('添加成功');
edit3.Text:='';
ComboBox10.Text:='';
ComboBox11.Text:='';
end;
end;
procedure TForm1.ComboBox14DropDown(Sender: TObject);
var i:integer;
begin
str_xy:='select 姓名 from 教师';
combobox14.Clear;
with adoquery2 do
begin close;
sql.Clear;
sql.Add(str_xy);
open;
end;
for i:=adoquery2.RecordCount downto 1 do
begin
SsnoSea:= adoquery2.Fields[0].AsString;
ComboBox14.Items.Add( SsnoSea);
adoquery2.next;
adoquery2.ExecSQL;
end;
end;
procedure TForm1.ComboBox14Change(Sender: TObject);
begin
str_xb:='select * from 教师 where 姓名 like '''+combobox14.Text+'''';
//one.Form1.ListBox2.Clear;
with one.Form1.adoquery2 do
begin close;
sql.Clear;
sql.Add(str_xb);
open;
end;
ComboBox12.Text:=adoquery2.Fields[1].AsString;
ComboBox13.Text:=adoquery2.Fields[2].AsString;
end;
procedure TForm1.ComboBox13DropDown(Sender: TObject);
var i:integer;
begin
str_xy:='select 学院 from 学院';
combobox13.Clear;
with adoquery2 do
begin close;
sql.Clear;
sql.Add(str_xy);
open;
end;
for i:=adoquery2.RecordCount downto 1 do
begin
SsnoSea:= adoquery2.Fields[0].AsString;
ComboBox13.Items.Add( SsnoSea);
adoquery2.next;
adoquery2.ExecSQL;
end;
end;
procedure TForm1.BitBtn14Click(Sender: TObject);
begin
str_xy:='update 教师 set 职称='''+ComboBox12.Text+''',院系='''+ComboBox13.Text+''' where 姓名 like '''+ComboBox14.Text+'''';
//combobox13.Clear;
//combobox12.Clear;
if ComboBox14.Text=''
then showmessage('姓名不能为空')
else
begin
with adoquery2 do
begin close;
sql.Clear;
sql.Add(str_xy);
execsql
end;
showmessage('修改成功');
combobox12.Text:='';
combobox13.Text:='';
combobox14.Text:='';
end;
end;
procedure TForm1.BitBtn15Click(Sender: TObject);
begin
if ComboBox14.Text=''
then showmessage('姓名不能为空')
else
if (application.MessageBox('确认删除','提示',mb_yesno+MB_ICONASTERISK)=idyes)
then
begin
begin
with adoquery2 do
adoquery2.Close;
adoquery2.SQL.Clear;
adoquery2.SQL.Add('delete from 教师 where 姓名='''+combobox14.Text+'''');
adoquery2.ExecSQL;
showmessage('删除成功');
combobox12.Text:='';
combobox13.Text:='';
combobox14.Text:='';
end;
end;
end;
procedure TForm1.TabbedNotebook3Change(Sender: TObject; NewTab: Integer;
var AllowChange: Boolean);
begin
GroupBox19.Visible:=false;
BitBtn17.Enabled:=false; //设置修改可用
BitBtn21.Enabled:=false;
//BitBtn17.Enabled:=false;//设置修改变灰
//BitBtn21.Enabled:=false;//设置删除变灰
Label21.Visible:=true;
Label22.Visible:=true;
Label23.Visible:=true;
Label24.Visible:=true;
Label25.Visible:=true;
MaskEdit4.Visible:=true;
MaskEdit5.Visible:=true;
MaskEdit6.Visible:=true;
MaskEdit7.Visible:=true;
edit7.Visible:=true;
end;
procedure TForm1.ComboBox16DropDown(Sender: TObject);
var i:integer;
begin
str_xy:='select 学院 from 学院';
combobox16.Clear;
with adoquery2 do
begin close;
sql.Clear;
sql.Add(str_xy);
open;
end;
for i:=adoquery2.RecordCount downto 1 do
begin
SsnoSea:= adoquery2.Fields[0].AsString;
ComboBox16.Items.Add( SsnoSea);
adoquery2.next;
adoquery2.ExecSQL;
begin
with adoquery3 do
adoquery3.Close;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -