数据库课程设计——教学管理系统论文网页版 下载本文

4.2.心得体会

通过自己查询相关书藉和对网络资源的利用,可以让我们对Borland Delphi 7 和Microsoft SQL Server 2000这两个开发工具有了具体的了解,从而上升到运用的层次;同时了解了开发一个系统所要做的具体工作。

参考文献

[1]萨师煊 王珊 “数据库系统概论”,高等教育出版社,1999

附件: unit Unit1; interface uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, ADODB, StdCtrls, jpeg, ExtCtrls; type

TForm1 = class(TForm) Image1: TImage; Label1: TLabel; Edit1: TEdit;

21

Label2: TLabel; Edit2: TEdit; Button1: TButton; Button2: TButton; ADOQuery1: TADOQuery; DataSource1: TDataSource; ADOConnection1: TADOConnection; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private

{ Private declarations } public

{ Public declarations } end; var

Form1: TForm1;

implementation

{$R *.dfm} uses unit2;

procedure TForm1.Button1Click(Sender: TObject); var username,password:string; begin

username :=trim(edit1.Text); password :=trim(edit2.Text); if username='' then begin

22

ShowMessage('用户名不能为空'); end

else if password='' then begin

ShowMessage('密码不能为空'); end else begin

adoquery1.Close; adoquery1.SQL.Clear;

adoquery1.SQL.Add('select * from login where username='''+username+''' and password ='''+password+''''); adoquery1.Open;

if adoquery1.RecordCount <1 then begin

showmessage('用户名或密码错误'); end else begin Form1.Hide; Form2.Show; end; end; end;

procedure TForm1.Button2Click(Sender: TObject); begin

Application.Terminate; end;

23

end. unit Unit2; interface uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Menus, StdCtrls, jpeg, ExtCtrls; type

TForm2 = class(TForm) MainMenu1: TMainMenu; N1: TMenuItem; N2: TMenuItem; N3: TMenuItem; N4: TMenuItem; N5: TMenuItem; N6: TMenuItem; Image1: TImage; Label1: TLabel; Label2: TLabel;

procedure N2Click(Sender: TObject); procedure N3Click(Sender: TObject); procedure N5Click(Sender: TObject); procedure N6Click(Sender: TObject); procedure N4Click(Sender: TObject);

24