您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 管理学资料 > Delphi+Access学生信息管理系统1.0
~Delphi学习记念全部资源文件(可直接用Delphi打开编辑)下载地址:效果图:源码:登录界面(从Access数据库读取对比用户名与密码):UnitLogin.pasunitUnitLogin;interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs,StdCtrls,ExtCtrls,jpeg;typeTFormLogin=class(TForm)Image1:TImage;Button1:TButton;Button2:TButton;ComboBox1:TComboBox;Edit1:TEdit;Label1:TLabel;Timer1:TTimer;lblMsg:TLabel;Label2:TLabel;shpBall2:TShape;shpBall1:TShape;procedureFormShow(Sender:TObject);procedureButton1Click(Sender:TObject);procedureButton2Click(Sender:TObject);procedureTimer1Timer(Sender:TObject);private{Privatedeclarations}public{Publicdeclarations}end;varFormLogin:TFormLogin;nowUser:String;nowPower:integer;implementation{$R*.dfm}usesUnitDataModule,UnitConsole;varisStop:boolean;procedureTFormLogin.FormShow(Sender:TObject);begindataModule1.adoTable1.Open;whiledataModule1.adoTable1.EOFtruedobegincomboBox1.Items.Append(dataModule1.adoTable1.FieldValues['user']);dataModule1.adotable1.Next;end;dataModule1.adoTable1.Close;isStop:=false;lblMsg.Visible:=false;end;procedureTFormLogin.Button1Click(Sender:TObject);varuser1,pwd1:string;beginuser1:=comboBox1.Text;pwd1:=edit1.Text;dataModule1.adoTable1.Open;dataModule1.adoTable1.First;whilenotdataModule1.adoTable1.EOFdobeginif(user1=DataModule1.adoTable1.FieldValues['user'])and(pwd1=DataModule1.adoTable1.FieldValues['pwd'])thenbeginnowUser:=user1;dataModule1.ADOQuery1.Close;dataModule1.ADOQuery1.SQL.Clear;dataModule1.ADOQuery1.SQL.Add('selectpowerfromAccountwhereuser='''+nowUser+'''');dataModule1.ADOQuery1.Open;nowPower:=dataModule1.ADOQuery1.Fields[0].AsInteger;formConsole.Show;Exit;end;DataModule1.adoTable1.Next;end;ShowMessage('登录失败,请重试!');edit1.Text:='';comboBox1.SetFocus;DataModule1.adoTable1.Close;end;procedureTFormLogin.Button2Click(Sender:TObject);beginApplication.Terminate;end;procedureTFormLogin.Timer1Timer(Sender:TObject);beginif(notisStop)thenbeginshpBall1.Left:=shpBall1.Left-10;shpBall2.Left:=shpBall2.Left+10;if(shpBall1.Left=100)thenisStop:=true;endelselblMsg.Visible:=true;end;end.预览界面:UnitConsole.pasunitUnitConsole;interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs,Menus,Grids,DBGrids,StdCtrls,ExtCtrls,jpeg;typeTFormConsole=class(TForm)MainMenu1:TMainMenu;view1:TMenuItem;User:TMenuItem;quit1:TMenuItem;DBGrid1:TDBGrid;DBGrid2:TDBGrid;Add:TMenuItem;help:TMenuItem;userMang:TMenuItem;time1:TTimer;Image1:TImage;lblSec:TLabel;lblNote:TLabel;lblMin:TLabel;lblHour:TLabel;Label2:TLabel;Label1:TLabel;editSec:TEdit;editMin:TEdit;editHour:TEdit;procedureview1Click(Sender:TObject);procedurequit1Click(Sender:TObject);procedureAddUserClick(Sender:TObject);procedureuserMangClick(Sender:TObject);procedureAddClick(Sender:TObject);procedurehelpClick(Sender:TObject);procedureFormShow(Sender:TObject);procedureFormCreate(Sender:TObject);proceduretime1Timer(Sender:TObject);private{Privatedeclarations}public{Publicdeclarations}end;varFormConsole:TFormConsole;implementation{$R*.dfm}usesUnitView,UnitAdd,UnitDataModule,UnitUserMang,UnitLogin;varhour,min,sec,msec:word;procedureTFormConsole.view1Click(Sender:TObject);beginformView.ShowModal;end;procedureTFormConsole.quit1Click(Sender:TObject);beginApplication.Terminate;end;procedureTFormConsole.AddUserClick(Sender:TObject);beginformAdd.ShowModal;end;procedureTFormConsole.userMangClick(Sender:TObject);beginformUserMang.ShowModal;end;procedureTFormConsole.AddClick(Sender:TObject);beginif(nowPower=1)thenformAdd.ShowModalelseShowMessage('您没有权限添加新用户,请联系管理员!');end;procedureTFormConsole.helpClick(Sender:TObject);beginShowMessage('Delphi学生信息管理系统1.0,纪念于2012.5.20.');end;procedureTFormConsole.FormShow(Sender:TObject);beginwithdataModule1.ADOQuery1dobeginClose;SQL.Text:='select*fromStudent';Open;end;end;procedureTFormConsole.FormCreate(Sender:TObject);beginDecodeTime(Now,hour,min,sec,msec);editHour.Text:=IntToStr(hour);editMin.Text:=IntToStr(min);editSec.Text:=IntToStr(sec);end;procedureTFormConsole.time1Timer(Sender:TObject);beginsec:=sec+1;if(sec=60)thenbeginmin:=min+1;sec:=0;end;if(min=60)thenbeginhour:=hour+1;min:=0;end;if(hour=24)thenbeginhour:=0;end;editHour.Text:=IntToStr(hour);editMin.Text:=IntToStr(min);editSec.Text:=IntToStr(sec);end;end.添加用户界面:UnitAdd.pasunitUnitAdd;interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs,StdCtrls,jpeg,ExtCtrls;typeTFormAdd=class(TForm)Image1:TImage;lblUser:TLabel;lblPwd2:TLabel;lblPower:TLabel;jlblPwd1:TLabel;editUser:TEdit;editPwd2:TEdit;editPwd1:TEdit;ComboBox1:TComboBox;btnQuit:TButton;btnOk:TButton;procedurebtnQuitClick(Sender:TObject);procedurebtnOkClick(Sender:TObject);private{Privatedeclarations}public{Publicdeclarations}end;varFormAdd:TFormAdd;implementation{$R*.dfm}usesUnitDataModule;procedureTFormAdd.btnQuitClick(Sender:TObject);beginClose;end;procedureTFormAdd.btnOkClick(Sender:TObject);varuser1,pwd1,pwd2,power:String;beginuser1:=editUser.Text;pwd1:=editPwd1.Text;pwd2:=editPwd2.Text;power:=IntToStr(comboBox1.ItemIndex+1);ifdataModule1.AD
本文标题:Delphi+Access学生信息管理系统1.0
链接地址:https://www.777doc.com/doc-3989838 .html