数据库系统源代码文档格式.docx
《数据库系统源代码文档格式.docx》由会员分享,可在线阅读,更多相关《数据库系统源代码文档格式.docx(14页珍藏版)》请在冰点文库上搜索。
![数据库系统源代码文档格式.docx](https://file1.bingdoc.com/fileroot1/2023-5/9/1ec81d4d-fdba-4523-b349-fb5d871d3f22/1ec81d4d-fdba-4523-b349-fb5d871d3f221.gif)
Button1:
TButton;
GroupBox1:
TGroupBox;
RadioButton1:
TRadioButton;
RadioButton2:
procedureButton1Click(Sender:
TObject);
private
{Privatedeclarations}
public
var
username,password:
string;
{Publicdeclarations}
end;
var
Form1:
TForm1;
implementation
usesunit2,unit3;
{$R*.dfm}
procedureTForm1.Button1Click(Sender:
begin
ifradiobutton2.checkedthen//如果radiobutton2被选中,就执行。
。
try
withadoquery1do//这里就开始对adoquery进行编辑了
begin
close;
sql.clear;
sql.add('
select*frommasterwhere管理员=:
管理员and密码=:
密码'
);
//搜索master表中所有的用户名,密码
parameters.ParamByName('
管理员'
).Value:
=trim(combobox1.Text);
//比对用户名
密码'
=trim(edit2.Text);
//比对密码
ifcombobox1.Text='
'
then
application.MessageBox('
请输入用户名'
'
提示信息'
64);
//用户名为空时弹出提示
combobox1.SetFocus;
exit;
ifComboBox1.Text='
请输入密码'
//假如密码为空时弹出提示edit2.SetFocus;
open;
ifadoquery1.RecordCount<
>
0then
Username:
=combobox1.Text;
Password:
=edit2.Text;
登陆成功'
form2.show;
//弹出form2窗口,也就是我们上节课设计好的管理员窗口
self.Hide;
end
else
输入的用户名或密码错误'
except
登陆失败'
else//对应第一个if,意思就是如果radiobutton2没被选中,也就是radiobutton1被选中
try
withadoquery1do
select*fromptwherea=:
aandb=:
b'
a'
ifedit2.Text='
edit2.SetFocus;
form3.show;
self.Hide;
elsebegin
finally
end.
2.管理员窗口
unitUnit2;
Dialogs,ExtCtrls,DBCtrls,Grids,DBGrids,DB,ADODB,StdCtrls,Buttons,jpeg;
TForm2=class(TForm)
Edit1:
DataSource1:
TDataSource;
DBGrid1:
TDBGrid;
DBNavigator1:
TDBNavigator;
Label3:
Edit3:
Button2:
Button3:
Button4:
procedureButton2Click(Sender:
procedureButton3Click(Sender:
procedureButton4Click(Sender:
Form2:
TForm2;
usesUnit4,unit1;
procedureTForm2.Button1Click(Sender:
SqlStr:
String;
='
select*fromstudentwherename='
+edit1.Text+'
;
adoquery1.Close;
//关闭ADOQuery1,以便于进行SQL语句更新
adoquery1.SQL.Clear;
//清空SQL语句
adoquery1.SQL.Add(sqlStr);
adoquery1.Open;
//新SQL有效
end;
procedureTForm2.Button2Click(Sender:
select*fromstudentwhere学号='
+edit2.Text+'
procedureTForm2.Button3Click(Sender:
select*fromstudentwhere短号='
+edit3.Text+'
procedureTForm2.Button4Click(Sender:
form1.show;
3.普通用户编辑窗口
unitUnit3;
Dialogs,StdCtrls,DBCtrls,DB,ADODB,jpeg,ExtCtrls;
TForm3=class(TForm)
Label4:
Label5:
DBText1:
TDBText;
DBText2:
DBText3:
Label6:
Label8:
GroupBox2:
Label9:
Label10:
Edit4:
Edit5:
Label7:
procedureFormShow(Sender:
Form3:
TForm3;
usesunit1,Unit4;
procedureTForm3.Button1Click(Sender:
updatestudentset学号='
短号='
name='
wherename='
+label2.caption+'
adoquery1.ExecSQL;
信息修改成功'
procedureTForm3.Button2Click(Sender:
varSqlStr:
ifedit4.Text=edit5.textthen
updateptsetb='
+edit4.Text+'
wherea='
密码修改成功'
end
输入密码不一致'
procedureTForm3.Button3Click(Sender:
form4.show;
procedureTForm3.FormShow(Sender:
label2.Caption:
=unit1.Form1.username;
adoquery1.open;
4.普通用户查询窗口
unitUnit4;
Dialogs,Grids,DBGrids,DB,ADODB,StdCtrls;
TForm4=class(TForm)
Form4:
TForm4;
procedureTForm4.Button1Click(Sender:
procedureTForm4.Button2Click(Sender:
procedureTForm4.Button3Click(Sender: