1、 Button1: TButton; GroupBox1: TGroupBox; RadioButton1: TRadioButton; RadioButton2: procedure Button1Click(Sender: TObject); private Private declarations public var username,password:string; Public declarations end;var Form1: TForm1;implementation uses unit2,unit3;$R *.dfmprocedure TForm1.Button1Clic
2、k(Sender:beginif radiobutton2.checked then/如果radiobutton2被选中,就执行。try with adoquery1 do/这里就开始对adoquery进行编辑了 begin close; sql.clear; sql.add(select * from master where 管理员=:管理员 and 密码=:密码 );/搜索master表中所有的用户名,密码 parameters.ParamByName(管理员).Value:=trim(combobox1.Text);/比对用户名密码=trim(edit2.Text);/比对密码 if
3、combobox1.Text = then application.MessageBox(请输入用户名,提示信息,64);/用户名为空时弹出提示 combobox1.SetFocus; exit; if ComboBox1.Text =请输入密码/假如密码为空时弹出提示 edit2.SetFocus; open; if adoquery1.RecordCount0 then Username:=combobox1.Text; Password:=edit2.Text;登陆成功 form2.show;/弹出form2窗口,也就是我们上节课设计好的管理员窗口 self.Hide; end else
4、输入的用户名或密码错误 except登陆失败 else/对应第一个if,意思就是如果radiobutton2没被选中,也就是radiobutton1被选中 try with adoquery1 doselect * from pt where a=:a and b=:ba if edit2.Text = edit2.SetFocus; form3.show;self.Hide; else begin finallyend.2.管理员窗口unit Unit2; Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, DB, ADODB, StdCtrls, But
5、tons, jpeg; TForm2 = class(TForm) Edit1: DataSource1: TDataSource; DBGrid1: TDBGrid; DBNavigator1: TDBNavigator; Label3: Edit3: Button2: Button3: Button4: procedure Button2Click(Sender: procedure Button3Click(Sender: procedure Button4Click(Sender: Form2: TForm2;uses Unit4,unit1;procedure TForm2.Butt
6、on1Click(Sender: SqlStr:String;=select * from student where name=+edit1.Text+; adoquery1.Close; /关闭ADOQuery1,以便于进行SQL语句更新 adoquery1.SQL.Clear; /清空SQL语句 adoquery1.SQL.Add(sqlStr); adoquery1.Open; /新SQL有效end;procedure TForm2.Button2Click(Sender:select * from student where 学号=+edit2.Text+procedure TFor
7、m2.Button3Click(Sender:select * from student where 短号=+edit3.Text+procedure TForm2.Button4Click(Sender: form1.show;3.普通用户编辑窗口unit Unit3; Dialogs, StdCtrls, DBCtrls, DB, ADODB, jpeg, ExtCtrls; TForm3 = class(TForm) Label4: Label5: DBText1: TDBText; DBText2: DBText3: Label6: Label8: GroupBox2: Label9:
8、 Label10: Edit4: Edit5: Label7: procedure FormShow(Sender: Form3: TForm3; uses unit1, Unit4;procedure TForm3.Button1Click(Sender:update student set 学号=,短号=,name= where name=+label2.caption+ adoquery1.ExecSQL;信息修改成功procedure TForm3.Button2Click(Sender:var SqlStr:if edit4.Text=edit5.text thenupdate pt
9、 set b=+edit4.Text+ where a=密码修改成功end输入密码不一致procedure TForm3.Button3Click(Sender: form4.show;procedure TForm3.FormShow(Sender: label2.Caption:=unit1.Form1.username; adoquery1.open;4.普通用户查询窗口unit Unit4; Dialogs, Grids, DBGrids, DB, ADODB, StdCtrls; TForm4 = class(TForm) Form4: TForm4;procedure TForm4.Button1Click(Sender:procedure TForm4.Button2Click(Sender:procedure TForm4.Button3Click(Sender:
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2