Delphi学生学籍管理系统
登录窗体、学生奖惩信息管理模块、学籍变动信息管理模块、系统管理模块、数据库创建
---- 系统主界面、院系信息管理模块、学生基本信息管理模块、学生教育经历管理模块、数据库的连接
2、设计的题目:学生学籍管理系统
3、系统中所用的数据表名及含义:需要完整Delphi学生学籍管理系统的请联系QQ3710167,免费
学生信息表:用来保存学生信息,表结构如下:
编号
字段名称
数据类型
长度
说明
1
学生证号
nvarchar
20
学生学号,主键
2
姓名
nvarchar
20
允许空
3
照片
nvarchar
200
允许空
4
性别
char
2
允许空
5
民族
nvarchar
20
允许空
6
生日
samlldatetime
4
允许空
7
籍贯
nvarchar
50
允许空
8
身份证号
nvarchar
20
允许空
9
家庭电话
nvarchar
30
允许空
10
居住地址
nvarchar
100
允许空
11
邮编
char
6
允许空
12
入校日期
samlldatetime
4
允许空
13
所在院系
nvarchar
30
允许空
14
职务
nvarchar
20
允许空
15
备注
nvarchar
100
允许空
院系表:用来保存学校各院系的基本信息,表结构如下:
编号
字段名
数据类型
长度
说明
1
id
int
4
记录编号,主键
2
院系名
nvarchar
30
允许空
3
上级id
int
4
允许空
教育经历表:用来保存学生教育经历的基本信息,表结构如下:
编号
字段名称
数据类型
长度
说明
1
id
int
4
记录编号,主键
2
学生证号
nvarchar
20
允许空
3
开始日期
smalldatetime
4
允许空
4
终止日期
smalldatetime
4
允许空
5
学生名称
nvarchar
50
允许空
6
职务
nvarchar
20
允许空
奖惩信息表:用来记录学生所受到的奖励或惩罚,结构如下:
编号
字段名称
数据类型
长度
说明
1
id
int
4
编号,主键
2
学生证号
nvarchar
20
允许空
3
奖惩日期
smalldatetime
4
允许空
4
奖惩类型
char
4
允许空
5
奖惩说明
nvarchar
100
允许空
学籍变动表:用来保存学生转学调班的记录,结构如下94:
Delphi学生学籍管理系统
编号
字段名称
数据类型
长度
说明
1
id
int
4
记录编号,主键
2
学生证号
nvarchar
20
允许空
3
变动类型
char
4
允许空
4
变动日期
smalldatetime
4
允许空
5
原班级编号
nvarchar
20
允许空
6
转入学校名称
nvarchar
50
允许空
7
转入班级编号
nvarchar
20
允许空
8
学籍变动原因
nvarchar
100
允许空
9
备注
nvarchar
100
允许空
操作员信息表:用来保存系统用户名、密码及权限级别等信息,结构如下:
编号
字段名称
数据类型
长度
说明
1
id
int
4
编号,主键
2
操作员id
nvarchar
20
允许空
3
操作员姓名
nvarchar
10
允许空
4
密码
nvarchar
20
允许空
5
权限
nvarchar
10
允许空
6
备注
nvarchar
100
允许空
关系图:定义关系如下:
关系名
主键表
主键字段
外键表
外键字段
FK_教育经历_学生信息
学生信息
学生证号
教育经历
学生证号
FK_奖惩信息_学生信息
学生信息
学生证号
奖惩信息
学生证号
FK_学籍变动_学生信息
学生信息
学生证号
学籍变动
学生证号
4、系统中各单元模块的单元名和功能简述:
0408008402:
1)登录窗体 frm_loginU.pas
功能:运行系统后对登录者进行身份验证,如果是非法用户则不能进入系统;如果是系统管理员则可以创建用户、修改用户信息以及删除用户;如果是系统操作员则只能修改自己的用户名和密码。同时本系统将用户登录的机会设置为3次,如果连续3次密码错误系统会自动关闭,以保证系统安全。
2)学生奖惩信息管理模块 frm_evaluationU.pas
功能:可以对学生的奖励和处罚信息进行添加、修改、删除和查询等操作。其中奖惩信息包括学生、奖惩类型和具体说明等信息,同时在添加奖惩信息时需要先选择学生信息。
3)学籍变动信息管理模块 frm_statusU.pas
功能:可以对学籍变动信息进行添加、修改、删除和查询等操作。学
Delphi学生学籍管理系统
籍变动包括学生、变动类型、转入学校、转入院系、学籍变动原因和备注等信息。同时在添加学籍变动信息时需要先选择学生和院系信息。
4)系统管理模块frm_changePwdU.pas、frm_operatorU.pas
功能:1、更改密码窗体frm_changePwdU.pas:可以用来修改当前用户的密码,系统会提示输入原密码、新密码以及新密码确认,通过这些操作实现用户密码修改。
2、操作员管理窗体frm_operatorU.pas:仅为系统管理员使用,通过此界面添加、删除、修改用户信息,指定用户权限。
0408008404:
1)系统主界面frm_mainU.pas
功能:为用户提供相应功能选择的界面,包括系统(退出)、学生管理(基本信息、奖惩信息、教育经历)、学籍管理(学籍变动信息)、设置(院系管理、操作员管理、更改密码)
2)院系信息管理模块frm_classU.pas
功能:可以添加、修改、删除和查看院系等操作,院系信息包括院系名称以及上机机构等。
3)学生基本信息管理模块frm_StudentU.pas
功能:可以对学生信息进行添加、修改、删除、和查看等操作。学生基本信息包括姓名、性别、民族、籍贯、出生日期、身份证号、家庭电话、居住地址、邮政编码等信息。用户还可以设置学生照片信息。在添加学生信息时,首先需要选择院系信息。
4)学生教育经历管理模块frm_experienceU.pas
功能:可以对学生教育经历进行添加、修改、删除和查看等操作。教育经历包括开始日期、结束日期、学校名称和职务等信息。在添加学生教育经历信息时需要先选择学生信息。
5、最高权限用户的用户名和密码:
admin 8888、ad 111、aa 111
6、数据库的配置方法
本系统采用统一的数据连接管理,在Data模块中的单元文件Config.pas中,定义数据库连接字符串connectionStr来改变连接,本实例默认的数据库服务器为本地计算机。数据库名为xjgl,数据库登录名为sa,密码为123456,在该模块中单元文件DAHelper.pas将全程序数据操作进行了有效的封装。在该单元中提供了两种方法:1、执行没有返回值的sql语句,如果正确执行则返回true,否则返回false.
2、执行有返回值的sql语句,返回得到ADOQuery.
Delphi学生学籍管理系统ClassesU窗体模板单元uses Graphics;//学生信息type TStudent=class stdNo:string;//学生证号 stdName:string; //姓名 picPath:string;//照片路径 sex:string;//性别 nation:string;//民族 birthday:string; native:string;//籍贯 IDCard:string;//身份证号 homeTel:string;//家庭电话 address:string;//居住地址 postalcode:string;//邮政编码 inDate:string;//入校日期 ClassName:string;//所在院系 duty:string;//职务 remark:string;//备注end;
//操作员信息type TOperator=class id:integer; Operid:string;//操作员ID OperName:string;//操作员姓名 pwd:string;//密码 privilege:string;//权限 remark:string;//备注end;//院系type TClasses=class id:integer; className:string;//院系名 fatherID:integer;//上级idend;//学籍变动type TStatus=class id:integer; studentNo:string; //学生编号 changeType:string;//变动类型 changeDate:string;//变动日期 oldClass:string;//原班级 newSchool:string;//转入学校 newClass:string;//转入班级 reason:string;//学籍变动原因 remark:string;//备注end;//奖惩信息type TEvaluation=class id:integer; stdNo:string;//学号 Edate:string;//奖惩日期 Etype:string;//奖惩类型 remark:string;//奖惩说明 end;//教育经历type TExperience=class id:integer; stdNo:string;//学号 beginDate:string;//开始日期 endDate:string;//结束日期 school:string;//学校名 duty:string;//职务 end;Control_classU院系管理单元代码//添加function Addclasses(classes:Tclasses):boolean;//修改院系function Editclasses(classes:Tclasses):boolean;//删除院系function Delclasses(classesID:integer):boolean;//得到院系记录function GetclassesArray:TADOQuery;//根据院系id查找院系信息function GetclassesByclassesID(classesID:integer):Tclasses;//根据院系名查找院系信息function GetclassesByName(className:string):Tclasses;//向Combobox中填充数据procedure FillCombobox(cbx:TCombobox);implementationprocedure FillCombobox(cbx:TCombobox);var query:TADOQuery;begin query:=TADOQuery.Create(nil); query:=GetclassesArray; cbx.Items.Clear; while not query.Eof do begin cbx.Items.Add(query.FieldValues['院系名']); query.Next; end; cbx.ItemIndex:=0; query:=nil;end;function GetclassesByName(className:string):Tclasses;var sql:string; classes:Tclasses; ADOQuery:TADOQuery;begin ADOQuery:=TADOQuery.Create(nil); sql:='select id,院系名,上级id from 院系'+ ' where 院系名='+''''+className+''''+ ' order by 院系名'; ADOQuery:=DAHelper.ExeSqlQuery(sql); if(ADOQuery.RecordCount<1) then begin result:=nil; end else begin classes:=Tclasses.Create; classes.id:=ADOQuery.Fields[0].Value; classes.className:=ADOQuery.Fields[1].Value; classes.fatherID:=ADOQuery.Fields[2].Value; result:=classes; end; ADOQuery:=nil;
end;function GetclassesByclassesID(classesID:integer):Tclasses;var sql:string; classes:Tclasses; ADOQuery:TADOQuery;begin ADOQuery:=TADOQuery.Create(nil); sql:='select id,院系名,上级id from 院系'+ ' where id='+inttostr(classesID); ADOQuery:=DAHelper.ExeSqlQuery(sql); if(ADOQuery.RecordCount<1) then begin result:=nil; end else begin classes:=Tclasses.Create; classes.id:=ADOQuery.Fields[0].Value; classes.className:=ADOQuery.Fields[1].Value; classes.fatherID:=ADOQuery.Fields[2].Value; result:=classes; end; ADOQuery:=nil;end;function GetclassesArray:TADOQuery;var sql:string;begin sql:='select a.id,a.院系名,a.上级id,isnull(b.院系名,''本校'') 上级院系名 from 院系 a '+ ' left outer join 院系 b on a.上级id=b.id'; result:=DAHelper.ExeSqlQuery(sql);end;function Delclasses(classesID:integer):boolean;var sql:string;begin sql:='delete from 院系 where id='+inttostr(classesID); result:=DAHelper.ExeSqlNoQuery(sql);end;function Editclasses(classes:Tclasses):boolean;var sql:string;begin sql:='update 院系 set 院系名='+''''+classes.className+''''+ ',上级id='+inttostr(classes.fatherID)+ ' where id='+inttostr(classes.id); result:=DAHelper.ExeSqlNoQuery(sql);end;function Addclasses(classes:Tclasses):boolean;var sql:string;begin sql:='insert into 院系(院系名,上级id)'+ ' values('+''''+classes.className+''''+ ','+inttostr(classes.fatherID)+ ')'; result:=DAHelper.ExeSqlNoQuery(sql);end;
Delphi学生学籍管理系统uses DAHelper,ClassesU,ADODB,SysUtils;//添加奖惩信息function AddEvaluation(Evaluation:TEvaluation):boolean;//修改奖惩信息function EditEvaluation(Evaluation:TEvaluation):boolean;//删除奖惩信息function DelEvaluation(EvaluationID:integer):boolean;//得到奖惩信息function GetEvaluationArray:TADOQuery;//查找奖惩信息,如果没有查找到该奖惩信息,返回空值function GetEvaluation(OpID:integer):TEvaluation;//查找奖惩信息by学号function GetEvaluationByStdNO(StdNO:string):TADOQuery;implementationfunction GetEvaluationByStdNO(StdNO:string):TADOQuery;var sql:string;begin sql:='select id,学生证号,奖惩日期,奖惩类型,isnull(奖惩说明,'''') 奖惩说明 from 奖惩信息'; if StdNO<>'' then sql:=sql+' where 学生证号='+''''+StdNO+''''; result:=DAHelper.ExeSqlQuery(sql);end;function GetEvaluation(OpID:integer):TEvaluation;var Evaluation:TEvaluation; sql:string; Adoquery:TADOQuery;begin sql:='select id,学生证号,奖惩日期,奖惩类型,isnull(奖惩说明,'''') 奖惩说明 from 奖惩信息'+ ' where ID='+inttostr(OpID); Adoquery:=DAHelper.ExeSqlQuery(sql); if Adoquery.RecordCount<1 then begin result:=nil; end else begin Evaluation:=TEvaluation.Create; Evaluation.id:=ADOQuery.Fields[0].Value; Evaluation.stdNo:=ADOQuery.Fields[1].Value; Evaluation.Edate:=DateToStr(ADOQuery.Fields[2].Value); Evaluation.Etype:=ADOQuery.Fields[3].Value; Evaluation.remark:=ADOQuery.Fields[4].Value; result:=Evaluation; end;end;function GetEvaluationArray:TADOQuery;var sql:string;begin sql:='select id,学生证号,奖惩日期,奖惩类型,isnull(奖惩说明,'''') 奖惩说明 from 奖惩信息'; result:=DAHelper.ExeSqlQuery(sql);end;function DelEvaluation(EvaluationID:integer):boolean;var sql:string;begin sql:='delete from 奖惩信息 where id='+inttostr(EvaluationID); result:=DAHelper.ExeSqlNoQuery(sql);end;function EditEvaluation(Evaluation:TEvaluation):boolean;var sql:string;begin sql:='update 奖惩信息 set 学生证号='+''''+Evaluation.stdNo+''''+ ',奖惩日期='+''''+Evaluation.Edate +''''+ ',奖惩类型='+''''+Evaluation.Etype +''''+ ',奖惩说明='+''''+Evaluation.remark+''''+ ' where id='+inttostr(Evaluation.id); result:=DAHelper.ExeSqlNoQuery(sql);end;function AddEvaluation(Evaluation:TEvaluation):boolean;var sql:string;begin sql:='insert into 奖惩信息(学生证号,奖惩日期,奖惩类型'+ ',奖惩说明)'+' values('+''''+Evaluation.stdNo+''''+ ','+''''+Evaluation.Edate+''''+ ','+''''+Evaluation.Etype+''''+ ','+''''+Evaluation.remark+''''+')'; result:=DAHelper.ExeSqlNoQuery(sql);end;Control_evaluationU奖惩信息单元代码Control_experienceU教育经历单元代码uses DAHelper,ClassesU,ADODB,SysUtils;//添加教育经历function AddExperience(Experience:TExperience):boolean;//修改教育经历function EditExperience(Experience:TExperience):boolean;//删除教育经历function DelExperience(ExperienceID:integer):boolean;//得到教育经历function GetExperienceArray:TADOQuery;//查找教育经历,如果没有查找到该教育经历,返回空值function GetExperience(OpID:integer):TExperience;//根据学号查找教育经历function GetExperienceByStdNO(StdNO:string):TADOQuery;implementationfunction GetExperienceByStdNO(StdNO:string):TADOQuery;var sql:string;begin sql:='select id,学生证号,开始日期,终止日期,学校名称,isnull(职务,'''') 职务 from 教育经历'; if StdNO<>'' then sql:=sql+' where 学生证号='+''''+StdNO+''''; result:=DAHelper.ExeSqlQuery(sql);end;function GetExperience(OpID:integer):TExperience;var Experience:TExperience; sql:string; Adoquery:TADOQuery;begin sql:='select id,学生证号,开始日期,终止日期,学校名称,isnull(职务,'''') 职务 from 教育经历'+ ' where ID='+inttostr(OpID); Adoquery:=DAHelper.ExeSqlQuery(sql); if Adoquery.RecordCount<1 then begin result:=nil; end else begin Experience:=TExperience.Create; Experience.id:=ADOQuery.Fields[0].Value; Experience.stdNo:=ADOQuery.Fields[1].Value; Experience.beginDate:=DateToStr(ADOQuery.Fields[2].Value); Experience.endDate:=DateToStr(ADOQuery.Fields[3].Value); Experience.school:=ADOQuery.Fields[4].Value; Experience.duty:=ADOQuery.Fields[5].Value; result:=Experience; end;end;function GetExperienceArray:TADOQuery;var sql:string;begin sql:='select id,学生证号,开始日期,终止日期,学校名称,isnull(职务,'''') 职务 from 教育经历'; result:=DAHelper.ExeSqlQuery(sql);end;function DelExperience(ExperienceID:integer):boolean;var sql:string;begin sql:='delete from 教育经历 where id='+inttostr(ExperienceID); result:=DAHelper.ExeSqlNoQuery(sql);end;function EditExperience(Experience:TExperience):boolean;var sql:string;begin sql:='update 教育经历 set 学生证号='+''''+Experience.stdNo+''''+ ',开始日期='+''''+Experience.beginDate+''''+ ',终止日期='+''''+Experience.endDate+''''+ ',学校名称='+''''+Experience.school+''''+ ',职务='+''''+Experience.duty+''''+ ' where id='+inttostr(Experience.id); result:=DAHelper.ExeSqlNoQuery(sql);end;function AddExperience(Experience:TExperience):boolean;var sql:string;begin sql:='insert into 教育经历(学生证号,开始日期,终止日期'+ ',学校名称,职务)'+' values('+''''+Experience.stdNo+''''+ ','+''''+Experience.beginDate+''''+ ','+''''+Experience.endDate+''''+ ','+''''+Experience.school+''''+ ','+''''+Experience.duty+''''+')'; result:=DAHelper.ExeSqlNoQuery(sql);end;Control_OperatorU系统管理单元代码uses DAHelper,ClassesU,ADODB,SysUtils;//添加操作员信息function AddOperator(Operator:TOperator):boolean;//修改操作员信息function EditOperator(Operator:TOperator):boolean;//删除操作员信息function DelOperator(OperatorID:integer):boolean;//得到操作员信息function GetOperatorArray:TADOQuery;//判断用户,如果没有查找到该用户,返回空值function CheckOperator(OpID,OpPwd:string):TOperator;//查找操作员by操作员idfunction GetOperatorByOperatorID(OperatorID:string):TOperator;//更改密码function ChangePwd(newPwd:string;id:integer):boolean;implementationfunction ChangePwd(newPwd:string;id:integer):boolean;var sql:string; begin sql:='update 操作员信息 set 密码='+''''+newPwd+''''+ ' where id='+inttostr(id); result:=DAHelper.ExeSqlNoQuery(sql); end;function GetOperatorByOperatorID(OperatorID:string):TOperator;var sql:string; Operator:TOperator; ADOQuery:TADOQuery;begin ADOQuery:=TADOQuery.Create(nil); sql:='select id,操作员ID,操作员姓名,密码,权限,isnull(备注,'''') 备注 from 操作员信息'+ ' where 操作员ID='+''''+OperatorID+''''; ADOQuery:=DAHelper.ExeSqlQuery(sql); if(ADOQuery.RecordCount<1) then begin result:=nil; end else begin Operator:=TOperator.Create; Operator.id:=ADOQuery.Fields[0].Value; Operator.Operid:=ADOQuery.Fields[1].Value; Operator.OperName:=ADOQuery.Fields[2].Value; Operator.pwd:=ADOQuery.Fields[3].Value; Operator.privilege:=ADOQuery.Fields[4].Value; Operator.remark:=ADOQuery.Fields[5].Value; result:=Operator; end; ADOQuery:=nil;end;function CheckOperator(OpID,OpPwd:string):TOperator;var Operator:TOperator; sql:string; Adoq:TADOQuery;begin sql:='select 操作员姓名,权限,isnull(备注,''''),id from 操作员信息'+ ' where 操作员ID='+''''+OpID+''''+' and '+ ' 密码='+''''+OpPwd+''''; Adoq:=DAHelper.ExeSqlQuery(sql); if Adoq.RecordCount<1 then begin result:=nil; end else begin Operator:=TOperator.Create; Operator.Operid:=OpID; Operator.OperName:=Adoq.Fields[0].Value; Operator.pwd:=OpPwd; Operator.privilege:=Adoq.Fields[1].Value; Operator.remark:=Adoq.Fields[2].Value; Operator.id:=Adoq.Fields[3].Value; result:=Operator; end;end;function GetOperatorArray:TADOQuery;var sql:string;begin sql:='select id,操作员ID,操作员姓名,密码,权限,isnull(备注,'''') 备注 from 操作员信息'; result:=DAHelper.ExeSqlQuery(sql);end;function DelOperator(OperatorID:integer):boolean;var sql:string;begin sql:='delete from 操作员信息 where id='+inttostr(OperatorID); result:=DAHelper.ExeSqlNoQuery(sql);end;function EditOperator(Operator:TOperator):boolean;var sql:string;begin sql:='update 操作员信息 set 操作员ID='+''''+Operator.Operid+''''+ ',操作员姓名='+''''+Operator.OperName +''''+ ',密码='+''''+Operator.pwd +''''+ ',权限='+''''+Operator.privilege+''''+ ',备注='+''''+Operator.remark+''''+ ' where id='+inttostr(Operator.id); result:=DAHelper.ExeSqlNoQuery(sql);end;function AddOperator(Operator:TOperator):boolean;var sql:string;begin sql:='insert into 操作员信息(操作员ID,操作员姓名,密码,权限,'+ '备注)'+' values('+''''+Operator.Operid+''''+','+''''+Operator.OperName+''''+ ','+''''+Operator.pwd+''''+','+''''+Operator.privilege+''''+ ','+''''+Operator.remark+''''+ ')'; result:=DAHelper.ExeSqlNoQuery(sql);end;
Delphi学生学籍管理系统
Control_statusU学籍变动单元代码uses DAHelper,ClassesU,ADODB,SysUtils;//添加学籍变动信息function AddStatus(Status:TStatus):boolean;//修改学籍变动信息function EditStatus(Status:TStatus):boolean;//删除学籍变动信息function DelStatus(id:integer):boolean;//得到学籍变动信息function GetStatusArray:TADOQuery;//根据学生号查找学籍变动信息function GetStatusByStdNo(StatusNo:string):TStatus;//根据学生号查找学籍变动信息,返回TADOQuery类型function GetStatusQueryByStdNo(StdNo:string):TADOQuery;implementationfunction GetStatusQueryByStdNo(StdNo:string):TADOQuery;var sql:string;begin sql:='select id,学生证号,变动类型,变动日期,原班级编号,'+ 'isnull(转入学校名称,'''') 转入学校名称,'+ 'isnull(转入班级编号,'''') 转入班级编号,'+ 'isnull(学籍变动原因,'''') 学籍变动原因,'+ 'isnull(备注,'''') 备注 from 学籍变动'+ ' where 学生证号='+''''+StdNo+''''; result:=DAHelper.ExeSqlQuery(sql);end;
function GetStatusByStdNo(StatusNo:string):TStatus;var sql:string; Status:TStatus; ADOQuery:TADOQuery;begin ADOQuery:=TADOQuery.Create(nil); sql:='select id,学生证号,变动类型,变动日期,原班级编号,'+ 'isnull(转入学校名称,'''') 转入学校名称,'+ 'isnull(转入班级编号,'''') 转入班级编号,'+ 'isnull(学籍变动原因,'''') 学籍变动原因,'+ 'isnull(备注,'''') 备注 from 学籍变动'+ ' where 学生证号='+''''+StatusNo+''''; ADOQuery:=DAHelper.ExeSqlQuery(sql); if(ADOQuery.RecordCount<1) then begin result:=nil; end else begin Status:=TStatus.Create; Status.id:=ADOQuery.Fields[0].Value; Status.studentNo:=ADOQuery.Fields[1].Value; Status.changeType:=ADOQuery.Fields[2].Value; Status.changeDate:=DateToStr(ADOQuery.Fields[3].Value); Status.oldClass:=ADOQuery.Fields[4].Value; Status.newSchool:=ADOQuery.Fields[5].Value; Status.newClass:=ADOQuery.Fields[6].Value; Status.reason:=ADOQuery.Fields[7].Value; Status.remark:=ADOQuery.Fields[8].Value; result:=Status; end; ADOQuery:=nil;end;function GetStatusArray:TADOQuery;var sql:string;begin sql:='select id,学生证号,变动类型,变动日期,原班级编号,'+ 'isnull(转入学校名称,'''') 转入学校名称,'+ 'isnull(转入班级编号,'''') 转入班级编号,'+ 'isnull(学籍变动原因,'''') 学籍变动原因,'+ 'isnull(备注,'''') 备注 from 学籍变动'; result:=DAHelper.ExeSqlQuery(sql);end;function DelStatus(id:integer):boolean;var sql:string;begin sql:='delete from 学籍变动 where id='+inttostr(id); result:=DAHelper.ExeSqlNoQuery(sql);end;function EditStatus(Status:TStatus):boolean;var sql:string;begin sql:='update 学籍变动 set 学生证号='+''''+Status.studentNo+''''+ ',变动类型='+''''+Status.changeType +''''+ ',原班级编号='+''''+Status.oldClass +''''+ ',转入学校名称='+''''+Status.newSchool+''''+ ',转入班级编号='+''''+Status.newClass+''''+ ',学籍变动原因='+''''+Status.reason+''''+ ',备注='+''''+Status.remark+''''+ ' where id='+inttostr(Status.id); result:=DAHelper.ExeSqlNoQuery(sql);end;function AddStatus(Status:TStatus):boolean;var sql:string;begin sql:='insert into 学籍变动(学生证号,变动类型,变动日期,原班级编号,'+ '转入学校名称,转入班级编号,学籍变动原因,'+ '备注)'+' values('+''''+Status.studentNo+''''+','+''''+Status.changeType+''''+ ','+''''+Status.changeDate+''''+','+''''+Status.oldClass+''''+','+ ''''+Status.newSchool+''''+','+ ''''+Status.newClass+''''+','+''''+Status.reason+''''+ ','+''''+Status.remark+''''+ ')'; result:=DAHelper.ExeSqlNoQuery(sql);end;Control_StudentU学生信息单元代码uses DAHelper,ClassesU,ADODB,SysUtils;//添加学生信息function AddStudent(Student:TStudent):boolean;//修改学生信息function EditStudent(Student:TStudent;stdNo:string):boolean;//删除学生信息function DelStudent(stdNo:string):boolean;//得到学生信息function GetStudentArray:TADOQuery;//根据学生号查找学生信息function GetStudentByStudentNo(StudentNo:string):TStudent;//根据学生号查找学生信息,返回TADOQuery类型function GetStudentQueryByStudentNo(StudentNo:string):TADOQuery;//根据学生姓名查找学生信息function GetStudentByName(studentName:string):TADOQuery;implementationfunction GetStudentQueryByStudentNo(StudentNo:string):TADOQuery;var sql:string;begin sql:='select 学生证号,姓名,照片,性别,民族,生日,籍贯,身份证号,isnull(家庭电话,'''') 家庭电话,'+ '居住地址,邮政编码,入校日期,所在院系'+ ',isnull(职务,'''') 职务,isnull(备注,'''') 备注 from 学生信息 '+ ' where 学生证号='+''''+studentNo+''''; result:=DAHelper.ExeSqlQuery(sql);end;function GetStudentByName(studentName:string):TADOQuery;var sql:string;begin sql:='select 学生证号,姓名,照片,性别,民族,生日,籍贯,身份证号,isnull(家庭电话,'''') 家庭电话,'+ '居住地址,邮政编码,入校日期,所在院系'+ ',isnull(职务,'''') 职务,isnull(备注,'''') 备注 from 学生信息 '+ ' where 姓名='+''''+studentName+''''; result:=DAHelper.ExeSqlQuery(sql);end;function GetStudentByStudentNo(StudentNo:string):TStudent;var sql:string; Student:TStudent; ADOQuery:TADOQuery;begin ADOQuery:=TADOQuery.Create(nil); sql:='select 学生证号,姓名,照片,性别,民族,生日,籍贯,身份证号,isnull(家庭电话,'''') 家庭电话,'+ '居住地址,邮政编码,入校日期,所在院系'+ ',isnull(职务,'''') 职务,isnull(备注,'''') 备注 from 学生信息 '+ ' where 学生证号='+''''+StudentNo+''''; ADOQuery:=DAHelper.ExeSqlQuery(sql); if(ADOQuery.RecordCount<1) then begin result:=nil; end else begin Student:=TStudent.Create; Student.stdNo:=ADOQuery.Fields[0].Value; Student.stdName:=ADOQuery.Fields[1].Value; Student.picPath:=ADOQuery.Fields[2].Value; Student.sex:=ADOQuery.Fields[3].Value; Student.nation:=ADOQuery.Fields[4].Value; Student.birthday:=DateToStr(ADOQuery.Fields[5].Value); Student.native:=ADOQuery.Fields[6].Value; Student.IDCard:=ADOQuery.Fields[7].Value; Student.homeTel:=ADOQuery.Fields[8].Value; Student.address:=ADOQuery.Fields[9].Value; Student.postalcode:=ADOQuery.Fields[10].Value; Student.inDate:=DateToStr(ADOQuery.Fields[11].Value); Student.ClassName:=ADOQuery.Fields[12].Value; Student.duty:=ADOQuery.Fields[13].Value; Student.remark:=ADOQuery.Fields[14].Value; result:=Student; end; ADOQuery:=nil;end;function GetStudentArray:TADOQuery;var sql:string;begin sql:='select 学生证号,姓名,照片,性别,民族,生日,籍贯,身份证号,isnull(家庭电话,'''') 家庭电话,'+ '居住地址,邮政编码,入校日期,所在院系'+ ',isnull(职务,'''') 职务,isnull(备注,'''') 备注 from 学生信息 '; result:=DAHelper.ExeSqlQuery(sql);end;function DelStudent(stdNo:string):boolean;var sql:string;begin sql:='delete from 学生信息 where 学生证号='+''''+stdNo+''''; result:=DAHelper.ExeSqlNoQuery(sql);end;function EditStudent(Student:TStudent;stdNo:string):boolean;var sql:string;begin sql:='update 学生信息 set 学生证号='+''''+Student.stdNo+''''+ ',姓名='+''''+Student.stdName +''''+ ',照片='+''''+Student.picPath+''''+ ',性别='+''''+Student.sex +''''+ ',民族='+''''+Student.nation+''''+ ',生日='+''''+Student.birthday+''''+ ',籍贯='+''''+Student.native+''''+ ',身份证号='+''''+Student.IDCard+''''+ ',家庭电话='+''''+Student.homeTel+''''+ ',居住地址='+''''+Student.address+''''+ ',邮政编码='+''''+Student.postalcode+''''+ ',入校日期='+''''+Student.inDate+''''+ ',所在院系='+''''+Student.ClassName+''''+ ',职务='+''''+Student.duty+''''+ ',备注='+''''+Student.remark+''''+ ' where 学生证号='+''''+stdNo+''''; result:=DAHelper.ExeSqlNoQuery(sql);end;function AddStudent(Student:TStudent):boolean;var sql:string;begin sql:='insert into 学生信息(学生证号,姓名,照片,性别,民族,生日,籍贯,身份证号,家庭电话,'+ '居住地址,邮政编码,入校日期,所在院系,职务,'+ '备注)'+' values('+''''+Student.stdNo+''''+','+''''+Student.stdName+''''+ ','+''''+Student.picPath+''''+','+''''+Student.sex+''''+','+ ''''+Student.nation+''''+','+ ''''+Student.birthday+''''+','+''''+Student.native+''''+ ','+''''+Student.IDCard+''''+','+''''+Student.homeTel+''''+ ','+''''+Student.address+''''+ ','+''''+Student.postalcode+''''+','+''''+Student.inDate+''''+ ','+''''+Student.ClassName+''''+','+''''+Student.duty+''''+ ','+''''+Student.remark+''''+ ')'; result:=DAHelper.ExeSqlNoQuery(sql);end;DataConfig数据库单元文件uses SysUtils,Classes,DB,ADODB;const//连接字符串connectionStr='Provider=SQLOLEDB.1;'+ 'Password=123456;Persist Security Info=True;'+ 'User ID=sa;Initial Catalog=xjgl;'+ 'Data Source=(local)';var ADOCon:TADOConnection;
Delphi学生学籍管理系统DataDAHelper数据库单元文件uses SysUtils, Classes, DB, ADODB,Config;//执行没有返回值的sql语句,如果正确执行则返回true,否则返回falsefunction ExeSqlNoQuery(sql:string):boolean;// 执行有返回值的sql语句,返回得到的ADOQuery;function ExeSqlQuery(sql:string):TADOQuery;implementationfunction ExeSqlQuery(sql:string):TADOQuery;var query:TADOQuery;begin try //判断连接状态是否关闭, 若关闭则打开 if stClosed in Config.ADOCon.State then Config.ADOCon.Open; query:=TADOQuery.Create(nil); query.Connection:=Config.ADOCon; query.Close; query.SQL.Clear; query.SQL.Add(sql); query.Open; except result:=nil; end; result:=query;end;function ExeSqlNoQuery(sql:string):boolean;var query:TADOQuery; ref:integer;begin ref:=0; //判断连接状态是否关闭, 若关闭则打开 if stClosed in Config.ADOCon.State then Config.ADOCon.Open; query:=TADOQuery.Create(nil); query.Connection:=Config.ADOCon; query.Close; Config.ADOCon.BeginTrans; try query.SQL.Clear; query.SQL.Add(sql); ref:=query.ExecSQL;//影响的行数 Config.ADOCon.CommitTrans; except Config.ADOCon.RollbackTrans; query:=nil; result:=false; end; if ref>0 then result:=true else result:=false;end;frm_changePwdU更改密码界面public currentUser:TOperator;end;
procedure Tfrm_changePwd.btn_cancelClick(Sender: TObject);beginclose;end;
procedure Tfrm_changePwd.FormClose(Sender: TObject; var Action: TCloseAction);beginaction:=cafree;end;
procedure Tfrm_changePwd.btn_okClick(Sender: TObject);beginif(self.edt_oldpwd.Text<>currentUser.pwd) then begin MessageBox(Handle, '原密码不正确!', '信息', MB_ICONEXCLAMATION); exit; end;if(self.edt_newpwd.Text <>self.edt_newpwd1.Text) then begin MessageBox(Handle, '新密码不统一!', '信息', MB_ICONEXCLAMATION); exit; end;if(trim(self.edt_newpwd.Text)='') then begin MessageBox(Handle, '密码不能为空!', '信息', MB_ICONEXCLAMATION); exit; end;if Control_OperatorU.ChangePwd(trim(self.edt_newpwd.Text),currentUser.id)then begin MessageBox(Handle, '修改成功!', '信息', MB_ICONASTERISK); endelse MessageBox(Handle, '更改失败!', '信息', MB_ICONEXCLAMATION);end;frm_classU院系管理界面procedure Tfrm_class.FillData;begin DataSource_info.DataSet:=Control_classU.GetclassesArray; self.DBGrid_info.Columns[0].Visible :=false; self.DBGrid_info.Columns[2].Visible :=false; self.FillCbx;end;procedure Tfrm_class.FillCbx;var query:TADOQuery;begin query:=TADOQuery.Create(nil); query:=Control_classU.GetclassesArray; self.cbx_class.Items.Clear; cbx_class.Items.Add('本校'); cbx_class.Tag:=0; while not query.Eof do begin self.cbx_class.Items.Add(query.Fields[1].Value ); query.Next; end; cbx_class.ItemIndex:=0; query:=nil;end;procedure Tfrm_class.btn_addClick(Sender: TObject);var Classes:TClasses; fatherID:integer;begin inherited; if((edt_Name.Text='')) then begin MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION); exit; end; //查找是否存在重复 if (GetclassesByName(trim(edt_name.Text)))<>nil then begin MessageBox(Handle, '该院系已经存在,请重新设置!', '信息', MB_ICONEXCLAMATION); exit; end; classes:=Tclasses.Create; classes.id:=edt_name.Tag; classes.className:=edt_name.Text; classes.fatherID:=self.cbx_class.Tag;
if(Control_classU.Addclasses(classes)) then begin MessageBox(Handle, '添加成功!', '信息', MB_ICONASTERISK); self.edt_name.Tag:=0; self.edt_name.Text:=''; self.cbx_class.ItemIndex:=0;
//刷新内容 FillData; end else begin MessageBox(Handle, '添加失败!', '信息', MB_ICONEXCLAMATION); exit; end;end;
procedure Tfrm_class.cbx_classChange(Sender: TObject);var Classes:TClasses;begin inherited; Classes:=TClasses.Create; Classes:=GetclassesByName(self.cbx_class.Text); if Classes<>nil then self.cbx_class.Tag:=Classes.id;end;
procedure Tfrm_class.btn_delClick(Sender: TObject);var Classes:TClasses;begin inherited; if MessageBox(Handle, '您确定要删除该院系信息', '信息', MB_ICONQUESTION or MB_OKCANCEL) = IDOK then begin Control_ClassU.DelClasses(self.edt_name.Tag); FillData; if self.DBGrid_info.Fields[0].IsNull then exit; self.edt_name.Tag:=self.DBGrid_info.Fields[0].Value;//保存id self.edt_name.Text :=self.DBGrid_info.Fields[1].Value; self.cbx_class.Tag:=self.DBGrid_info.Fields[2].Value; self.cbx_class.Text:=self.DBGrid_info.Fields[3].Value; end;end;
procedure Tfrm_class.btn_editClick(Sender: TObject);var Classes:TClasses;begininherited; if edt_name.Text ='' then begin MessageBox(Handle, '没有可以修改的数据!', '信息', MB_ICONEXCLAMATION); exit; end; //查找是否存在重复 Classes:=TClasses.Create; Classes:=GetclassesByName(trim(edt_name.Text)); if(Classes<>nil) then begin if(Classes.id<>edt_name.Tag) then begin MessageBox(Handle, '该院系已经存在,请重新设置!', '信息', MB_ICONEXCLAMATION); exit; end; end; Classes:=TClasses.Create; Classes.id:=edt_name.Tag; Classes.className:=edt_name.Text; Classes.fatherID:=self.cbx_class.Tag; if(Control_ClassU.EditClasses(Classes)) then begin MessageBox(Handle, '修改成功!', '畔?, MB_ICONASTERISK); //刷新内容 FillData; end else begin MessageBox(Handle, '修改失败!', '信息', MB_ICONEXCLAMATION); exit; end; self.edt_name.SetFocus;end;
procedure Tfrm_class.DBGrid_infoCellClick(Column: TColumn);begin inherited;self.edt_name.Tag:=self.DBGrid_info.Fields[0].Value;//保存idself.edt_name.Text :=self.DBGrid_info.Fields[1].Value;self.cbx_class.Tag:=self.DBGrid_info.Fields[2].Value;self.cbx_class.Text:=self.DBGrid_info.Fields[3].Value;end;
Delphi学生学籍管理系统
frm_evaluationU奖惩信息界面public procedure FillData;override; end;
procedure Tfrm_evaluation.FillData;begin self.DataSource_info.DataSet:=Control_evaluationU.GetEvaluationArray; self.DBGrid_info.Columns[0].Visible :=false;end;
procedure Tfrm_evaluation.btn_addClick(Sender: TObject);var Evaluation:TEvaluation; Student:TStudent;begin inherited; if((edt_stdNo.Text='')) then begin MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION); exit; end; Student:=TStudent.Create; Student:=Control_StudentU.GetStudentByStudentNo(self.edt_stdNo.Text); if Student=nil then begin MessageBox(Handle, '学号填写不正确!', '信息', MB_ICONEXCLAMATION); edt_stdNo.SetFocus; exit; end;
Evaluation:=TEvaluation.Create; Evaluation.id:=edt_stdNo.Tag; Evaluation.stdNo:=trim(self.edt_stdNo.Text); Evaluation.Edate:=DateToStr(now); Evaluation.Etype:=self.cbx_type.Text; Evaluation.remark:=self.Memo_remark.Text;
if(Control_EvaluationU.AddEvaluation(Evaluation)) then begin MessageBox(Handle, '添加成功!', '信息', MB_ICONASTERISK); //刷新内容 FillData; if self.DBGrid_info.Fields[0].IsNull then begin self.edt_stdNo.Tag:=0;//保存id self.edt_stdNo.Text:=''; self.edt_edate.Text :=''; self.cbx_type.ItemIndex:=0; self.Memo_remark.Text:=''; end else begin self.edt_stdNo.Tag:=self.DBGrid_info.Fields[0].Value;//保存id self.edt_stdNo.Text:=self.DBGrid_info.Fields[1].Value; self.edt_edate.Text :=self.DBGrid_info.Fields[2].Value; self.cbx_type.Text:=self.DBGrid_info.Fields[3].Value; self.Memo_remark.Text:=self.DBGrid_info.Fields[4].Value; end; end else begin MessageBox(Handle, '添加失败!', '信息', MB_ICONEXCLAMATION); exit; end;end;
procedure Tfrm_evaluation.btn_delClick(Sender: TObject);begin inherited;if MessageBox(Handle, '您确定要删除该信息', '信息', MB_ICONQUESTION or MB_OKCANCEL) = IDOK then begin Control_evaluationU.Delevaluation(self.edt_stdNo.Tag); FillData; if self.DBGrid_info.Fields[0].IsNull then begin self.edt_stdNo.Tag:=0;//保存id self.edt_stdNo.Text:=''; self.edt_edate.Text :=''; self.cbx_type.ItemIndex:=0; self.Memo_remark.Text:=''; end else begin self.edt_stdNo.Tag:=self.DBGrid_info.Fields[0].Value;//保存id self.edt_stdNo.Text:=self.DBGrid_info.Fields[1].Value; self.edt_edate.Text :=self.DBGrid_info.Fields[2].Value; self.cbx_type.Text:=self.DBGrid_info.Fields[3].Value; self.Memo_remark.Text:=self.DBGrid_info.Fields[4].Value; end; end;end;
procedure Tfrm_evaluation.btn_editClick(Sender: TObject);var Evaluation:TEvaluation; Student:TStudent;begin inherited; if edt_stdNo.Text ='' then begin MessageBox(Handle, '没有可以修改的数据!', '信息', MB_ICONEXCLAMATION); exit; end else begin if((edt_stdNo.Text='')) then begin MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION); exit; end; Student:=TStudent.Create; Student:=Control_StudentU.GetStudentByStudentNo(self.edt_stdNo.Text); if Student=nil then begin MessageBox(Handle, '学号填写不正确!', '信息', MB_ICONEXCLAMATION); edt_stdNo.SetFocus; exit; end;
Evaluation:=TEvaluation.Create; Evaluation.id:=edt_stdNo.Tag; Evaluation.stdNo:=trim(self.edt_stdNo.Text); Evaluation.Edate:=trim(self.edt_edate.Text); Evaluation.Etype:=self.cbx_type.Text; Evaluation.remark:=self.Memo_remark.Text;
if(Control_evaluationU.Editevaluation(evaluation)) then begin MessageBox(Handle, '修改成功!', '信息', MB_ICONASTERISK); //刷新内容 FillData; end else begin MessageBox(Handle, '修改失败!', '信息', MB_ICONEXCLAMATION); exit; end; self.edt_stdNo.SetFocus; end;end;
procedure Tfrm_evaluation.DBGrid_infoCellClick(Column: TColumn);begin inherited; if self.DBGrid_info.Fields[0].IsNull then begin self.edt_stdNo.Tag:=0;//保存id self.edt_stdNo.Text:=''; self.edt_edate.Text :=''; self.cbx_type.ItemIndex:=0; self.Memo_remark.Text:=''; end else begin self.edt_stdNo.Tag:=self.DBGrid_info.Fields[0].Value;//保存id self.edt_stdNo.Text:=self.DBGrid_info.Fields[1].Value; self.edt_edate.Text :=self.DBGrid_info.Fields[2].Value; self.cbx_type.Text:=self.DBGrid_info.Fields[3].Value; self.Memo_remark.Text:=self.DBGrid_info.Fields[4].Value; end;end;
procedure Tfrm_evaluation.btn_search_stdNoClick(Sender: TObject);begin inherited; self.DataSource_info.DataSet:= Control_evaluationU.GetEvaluationByStdNO(self.edt_stdNo_s.Text); self.DBGrid_info.Columns[0].Visible :=false;end;frm_experienceU教育经历界面public procedure FillData;override; end;
procedure Tfrm_experience.FillData;begin self.DataSource_info.DataSet:=Control_experienceU.GetExperienceArray; self.DBGrid_info.Columns[0].Visible :=false;end;
procedure Tfrm_experience.btn_addClick(Sender: TObject);var Experience:TExperience; Student:TStudent;begin inherited; if((edt_stdNo.Text='') or (edt_school.Text='') or (DTP_beginDate.Date>DTP_endDate.Date)) then begin MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION); exit; end; Student:=TStudent.Create; Student:=Control_StudentU.GetStudentByStudentNo(self.edt_stdNo.Text); if Student=nil then begin MessageBox(Handle, '学号填写不正确!', '信息', MB_ICONEXCLAMATION); edt_stdNo.SetFocus; exit; end;
Experience:=TExperience.Create; Experience.id:=edt_stdNo.Tag; Experience.stdNo:=trim(self.edt_stdNo.Text); Experience.beginDate:=DateToStr(self.DTP_beginDate.Date); Experience.endDate:=DateToStr(self.DTP_endDate.Date); Experience.school:=self.edt_school.Text; Experience.duty:=self.edt_duty.Text;
if(Control_ExperienceU.AddExperience(Experience)) then begin MessageBox(Handle, '添加成功!', '信息', MB_ICONASTERISK); //刷新内容 FillData; if self.DBGrid_info.Fields[0].IsNull then begin self.edt_stdNo.Tag:=0;//保存id self.edt_stdNo.Text:=''; self.DTP_beginDate.Date :=now; self.DTP_endDate.Date:=now; self.edt_school.Text:=''; self.edt_duty.Text:=''; end else begin self.edt_stdNo.Tag:=self.DBGrid_info.Fields[0].Value;//保存id self.edt_stdNo.Text:=self.DBGrid_info.Fields[1].Value; self.DTP_beginDate.Date :=self.DBGrid_info.Fields[2].Value; self.DTP_endDate.Date:=self.DBGrid_info.Fields[3].Value; self.edt_school.Text:=self.DBGrid_info.Fields[4].Value; self.edt_duty.Text:=self.DBGrid_info.Fields[5].Value; end; end else begin MessageBox(Handle, '添加失败!', '信息', MB_ICONEXCLAMATION); exit; end;end;
procedure Tfrm_experience.btn_delClick(Sender: TObject);begin inherited;if MessageBox(Handle, '您确定要删除该信息', '信息', MB_ICONQUESTION or MB_OKCANCEL) = IDOK then begin Control_ExperienceU.DelExperience(self.edt_stdNo.Tag); FillData; if self.DBGrid_info.Fields[0].IsNull then begin self.edt_stdNo.Tag:=0;// self.edt_stdNo.Text:=''; self.DTP_beginDate.Date :=now; self.DTP_endDate.Date:=now; self.edt_school.Text:=''; self.edt_duty.Text:=''; end else begin self.edt_stdNo.Tag:=self.DBGrid_info.Fields[0].Value;//保存id self.edt_stdNo.Text:=self.DBGrid_info.Fields[1].Value; self.DTP_beginDate.Date :=self.DBGrid_info.Fields[2].Value; self.DTP_endDate.Date:=self.DBGrid_info.Fields[3].Value; self.edt_school.Text:=self.DBGrid_info.Fields[4].Value; self.edt_duty.Text:=self.DBGrid_info.Fields[5].Value; end; end;end;
procedure Tfrm_experience.btn_editClick(Sender: TObject);var Experience:TExperience; Student:TStudent;begin inherited; if edt_stdNo.Text ='' then begin MessageBox(Handle, '没有可以修改的数据!', '信息', MB_ICONEXCLAMATION); exit; end else begin if((edt_stdNo.Text='') or (edt_school.Text='') or (DTP_beginDate.Date>DTP_endDate.Date)) then begin MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION); exit; end; Student:=TStudent.Create; Student:=Control_StudentU.GetStudentByStudentNo(self.edt_stdNo.Text); if Student=nil then begin MessageBox(Handle, '学号填写不正确!', '信息', MB_ICONEXCLAMATION); edt_stdNo.SetFocus; exit; end;
Experience:=TExperience.Create; Experience.id:=edt_stdNo.Tag; Experience.stdNo:=trim(self.edt_stdNo.Text); Experience.beginDate:=DateToStr(self.DTP_beginDate.Date); Experience.endDate:=DateToStr(self.DTP_endDate.Date); Experience.school:=self.edt_school.Text; Experience.duty:=self.edt_duty.Text;
if(Control_ExperienceU.EditExperience(Experience)) then begin MessageBox(Handle, '修改成功!', '信息', MB_ICONASTERISK); //刷新内容 FillData; end else begin MessageBox(Handle, '修改失败!', '信息', MB_ICONEXCLAMATION); exit; end; self.edt_stdNo.SetFocus; end;end;
procedure Tfrm_experience.DBGrid_infoCellClick(Column: TColumn);begin inherited; if self.DBGrid_info.Fields[0].IsNull then begin self.edt_stdNo.Tag:=0;// self.edt_stdNo.Text:=''; self.DTP_beginDate.Date :=now; self.DTP_endDate.Date:=now; self.edt_school.Text:=''; self.edt_duty.Text:=''; end else begin self.edt_stdNo.Tag:=self.DBGrid_info.Fields[0].Value;//保存id self.edt_stdNo.Text:=self.DBGrid_info.Fields[1].Value; self.DTP_beginDate.Date :=self.DBGrid_info.Fields[2].Value; self.DTP_endDate.Date:=self.DBGrid_info.Fields[3].Value; self.edt_school.Text:=self.DBGrid_info.Fields[4].Value; self.edt_duty.Text:=self.DBGrid_info.Fields[5].Value; end;end;
procedure Tfrm_experience.btn_search_stdNoClick(Sender: TObject);begin inherited; self.DataSource_info.DataSet:= Control_experienceU.GetExperienceByStdNO(self.edt_stdNo_s.Text); self.DBGrid_info.Columns[0].Visible :=false;end;frm_infoU各管理窗体模板procedure Tfrm_info.btn_exitClick(Sender: TObject);beginclose;end;
procedure Tfrm_info.FormClose(Sender: TObject; var Action: TCloseAction);beginaction:=cafree;end;
procedure Tfrm_info.FormShow(Sender: TObject);beginFillData;end;
procedure Tfrm_info.DBGrid_infoCellClick(Column: TColumn);beginif self.DBGrid_info.Fields[0].IsNull then exit;end;
Delphi学生学籍管理系统
frm_loginU登录界面var frm_login: Tfrm_login; inputNum:integer; //记录用户输入次数implementationuses Control_OperatorU,Config, frm_mainU;{$R *.dfm}
procedure Tfrm_login.btn_cancelClick(Sender: TObject);beginApplication.Terminate;end;
procedure Tfrm_login.btn_okClick(Sender: TObject);var OpID,OpPwd:string; Op:TOperator;beginConfig.ADOCon:=TADOConnection.Create(nil);Config.ADOCon.LoginPrompt:=false;Config.ADOCon.KeepConnection:=true; begin Config.ADOCon.ConnectionString:=Config.connectionStr; Config.ADOCon.Open; end;OpID:=self.edt_name.Text;OpPwd:=self.edt_pwd.Text;Op:=TOperator.Create;Op:=Control_OperatorU.CheckOperator(OpID,OpPwd);if (Op=nil) then begin MessageBox(Handle, '用户名或密码错误!', '信息', MB_ICONEXCLAMATION); inc(inputNum); if(inputNum>2)then begin MessageBox(Handle, '输入错误次数超过3次!', '信息', MB_ICONEXCLAMATION); Application.Terminate; end; frm_login:=Tfrm_login.Create(self); frm_login.ShowModal; endelse begin frm_main.Visible:=true; frm_main.CurrentUser:=Op;//保存当前用户 //根据用户权限设置菜单 if(Op.privilege='操作员') then begin frm_main.Nclass.Enabled:=false; frm_main.Noperator.Enabled:=false; end; self.Close; end;end;
procedure Tfrm_login.FormCreate(Sender: TObject);begininputNum:=0;//初始化记录用户输入次数end;frm_mainU主界面uses frm_loginU,frm_StudentU,frm_operatorU,frm_changePwdU,frm_classU,frm_statusU,frm_evaluationU,frm_experienceU;{$R *.dfm}
procedure TFrm_main.FormCreate(Sender: TObject);var frm_login:Tfrm_login;begin frm_login:=Tfrm_login.Create(self); frm_login.ShowModal;end;
procedure TFrm_main.FormClose(Sender: TObject; var Action: TCloseAction);beginConfig.ADOCon.Close;end;
procedure TFrm_main.NOperatorClick(Sender: TObject);var frm_operator:Tfrm_operator;beginfrm_operator:=Tfrm_operator.Create(self);frm_operator.ShowModal;end;
procedure TFrm_main.NStudentInfoClick(Sender: TObject);var frm_Student:Tfrm_Student;begin frm_Student:=Tfrm_Student.Create(self); frm_Student.ShowModal;end;
procedure TFrm_main.NCloseClick(Sender: TObject);begin close;end;
procedure TFrm_main.NChangePwdClick(Sender: TObject);var frm_changePwd:Tfrm_changePwd;begin frm_changePwd:=Tfrm_changePwd.Create(self); frm_changePwd.currentUser:=self.CurrentUser; frm_changePwd.ShowModal;end;
procedure TFrm_main.NclassClick(Sender: TObject);var frm_class:Tfrm_class;begin frm_class:=Tfrm_class.Create(self); frm_class.ShowModal;end;
procedure TFrm_main.NoutClick(Sender: TObject);var frm_status:Tfrm_status;begin frm_status:=Tfrm_status.Create(self); frm_status.ShowModal;end;
procedure TFrm_main.NevaluationClick(Sender: TObject);var frm_evaluation:Tfrm_evaluation;begin frm_evaluation:=Tfrm_evaluation.Create(self); frm_evaluation.ShowModal;end;
procedure TFrm_main.NexperienceClick(Sender: TObject);var frm_experience:Tfrm_experience;begin frm_experience:=Tfrm_experience.Create(self); frm_experience.ShowModal;end;frm_operatorU操作员管理界面public procedure FillData;override;end;
procedure Tfrm_operator.FillData;begin DataSource_info.DataSet:=Control_OperatorU.GetOperatorArray; self.DBGrid_info.Columns[0].Visible :=false; self.DBGrid_info.Columns[3].Visible :=false; //让密码不可见end;procedure Tfrm_operator.DBGrid_infoCellClick(Column: TColumn);begin inherited;if self.DBGrid_info.Fields[0].IsNull then exit; self.edt_OperatorID.Tag:=self.DBGrid_info.Fields[0].Value;//保存id self.edt_OperatorID.Text:=self.DBGrid_info.Fields[1].Value; self.edt_name.Text :=self.DBGrid_info.Fields[2].Value; self.edt_pwd.Text:=self.DBGrid_info.Fields[3].Value; self.cbx_privilege.Text:=self.DBGrid_info.Fields[4].Value; self.Memo_remark.Text:=self.DBGrid_info.Fields[5].Value;end;
procedure Tfrm_operator.btn_addClick(Sender: TObject);var Operator:TOperator;begin inherited; if((edt_OperatorID.Text='') or (edt_Name.Text='') or (edt_pwd.Text='') or (self.cbx_privilege.Text='') ) then begin MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION); exit; end; //查找是否存在重复 if (GetOperatorByOperatorID(trim(edt_OperatorID.Text)))<>nil then begin MessageBox(Handle, '操作员ID已经存在,请重新设置!', '信息', MB_ICONEXCLAMATION); exit; end; Operator:=TOperator.Create; Operator.id:=edt_OperatorID.Tag; Operator.Operid:=trim(self.edt_OperatorID.Text); Operator.OperName:=trim(self.edt_name.Text); Operator.pwd:=trim(self.edt_pwd.Text); Operator.privilege:=trim(self.cbx_privilege.Text); Operator.remark:=self.Memo_remark.Text; if(Control_OperatorU.AddOperator(Operator)) then begin MessageBox(Handle, '添加成功!', '信息', MB_ICONASTERISK); //刷新内容 FillData; end else begin MessageBox(Handle, '添加失败!', '信息', MB_ICONEXCLAMATION); exit; end;end;
procedure Tfrm_operator.btn_editClick(Sender: TObject);var Operator:TOperator;begininherited; if edt_OperatorID.Text ='' then begin MessageBox(Handle, '没有可以修改的数据!', '信息', MB_ICONEXCLAMATION); exit; end else begin if((edt_OperatorID.Text='') or (edt_Name.Text='') or (edt_pwd.Text='') or (self.cbx_privilege.Text='') ) then begin MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION); exit; end; //查找是否存在重复 Operator:=TOperator.Create; Operator:=GetOperatorByOperatorID(trim(edt_OperatorID.Text)); if(Operator<>nil) then begin if(Operator.id<>edt_OperatorID.Tag) then begin MessageBox(Handle, '操作员ID已经存在,请重新设置!', '信息', MB_ICONEXCLAMATION); exit; end; end; Operator:=TOperator.Create; Operator.id:=edt_OperatorID.Tag; Operator.Operid:=trim(self.edt_OperatorID.Text); Operator.OperName:=trim(self.edt_name.Text); Operator.pwd:=trim(self.edt_pwd.Text); Operator.privilege:=trim(self.cbx_privilege.Text); Operator.remark:=self.Memo_remark.Text; if(Control_OperatorU.EditOperator(Operator)) then begin MessageBox(Handle, '修改成功!', '信息', MB_ICONASTERISK); //刷新内容 FillData; end else begin MessageBox(Handle, '修改失败!', '信息', MB_ICONEXCLAMATION); exit; end; self.edt_OperatorID.SetFocus;end;
end;
procedure Tfrm_operator.btn_delClick(Sender: TObject);var Operator:TOperator;begin inherited; if MessageBox(Handle, '您确定要删除该操作员信息', '信息', MB_ICONQUESTION or MB_OKCANCEL) = IDOK then begin Control_OperatorU.DelOperator(self.edt_OperatorID.Tag); FillData; if self.DBGrid_info.Fields[0].IsNull then exit; self.edt_OperatorID.Tag:=self.DBGrid_info.Fields[0].Value;//保存id self.edt_OperatorID.Text:=self.DBGrid_info.Fields[1].Value; self.edt_name.Text :=self.DBGrid_info.Fields[2].Value; self.edt_pwd.Text:=self.DBGrid_info.Fields[3].Value; self.cbx_privilege.Text:=self.DBGrid_info.Fields[4].Value; self.Memo_remark.Text:=self.DBGrid_info.Fields[5].Value; end;end;
Delphi学生学籍管理系统
frm_statusU学籍变动界面public procedure FillData;override;end;
procedure Tfrm_status.FillData;begin DataSource_info.DataSet:=Control_StatusU.GetStatusArray; self.DBGrid_info.Columns[0].Visible :=false;end;procedure Tfrm_status.ChangeUIByType(typeStr:string);begin if (typeStr='退学') or (typeStr='休学') then begin self.Lab_newclass.Visible:=false; self.edt_newClass.Visible:=false; self.lab_newSchool.Visible:=false; self.edt_newSchool.Visible:=false; end else begin if (typeStr='转学') then begin self.Lab_newclass.Visible:=false; self.edt_newClass.Visible:=false; self.lab_newSchool.Visible:=true; self.edt_newSchool.Visible:=true; end; if (typeStr='调班') then begin self.Lab_newclass.Visible:=true; self.edt_newClass.Visible:=true; self.lab_newSchool.Visible:=false; self.edt_newSchool.Visible:=false; end; end;end;procedure Tfrm_status.cbx_typeChange(Sender: TObject);begin inherited; ChangeUIByType(cbx_type.Text);end;
procedure Tfrm_status.btn_addClick(Sender: TObject);var Student:TStudent; Status:TStatus;begin inherited; if((self.edt_stdNo.Text='')) then begin MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION); exit; end; Student:=TStudent.Create; Student:=Control_StudentU.GetStudentByStudentNo(self.edt_stdNo.Text); if Student=nil then begin MessageBox(Handle, '学号填写不正确!', '信息', MB_ICONEXCLAMATION); edt_stdNo.SetFocus; exit; end; self.edt_oldClass.Text:=Student.ClassName;
Status:=TStatus.Create; Status.studentNo:=self.edt_stdNo.Text; Status.changeType:=self.cbx_type.Text; Status.changeDate:=DateToStr(now); Status.oldClass:=self.edt_oldClass.Text; Status.newSchool:=self.edt_newSchool.Text; Status.newClass:=self.edt_newClass.Text; Status.reason:=self.Memo_reason.Text; Status.remark:=self.Memo_remark.Text;
if(Control_StatusU.AddStatus(Status)) then begin MessageBox(Handle, '添加成功!', '信息', MB_ICONASTERISK); //刷新内容 FillData; end else begin MessageBox(Handle, '添加失败!', '信息', MB_ICONEXCLAMATION); exit; end;end;
procedure Tfrm_status.btn_delClick(Sender: TObject);begin inherited; if MessageBox(Handle, '您确定要删除该条信息', '信息', MB_ICONQUESTION or MB_OKCANCEL) = IDOK then begin Control_statusU.Delstatus(self.edt_stdNo.Tag); FillData; if self.DBGrid_info.Fields[0].IsNull then exit; self.edt_stdNo.Tag:=self.DBGrid_info.Fields[0].Value;//保存id self.edt_stdNo.Text:=self.DBGrid_info.Fields[1].Value; self.cbx_type.Text:=self.DBGrid_info.Fields[2].Value; self.edt_changeDate.Text:=self.DBGrid_info.Fields[3].Value; self.edt_oldClass.Text:=self.DBGrid_info.Fields[4].Value; self.edt_newSchool.Text:=self.DBGrid_info.Fields[5].Value; self.edt_newClass.Text:=self.DBGrid_info.Fields[6].Value; self.Memo_reason.Text :=self.DBGrid_info.Fields[7].Value; self.Memo_remark.Text:=self.DBGrid_info.Fields[8].Value; end;end;
procedure Tfrm_status.btn_editClick(Sender: TObject);var status:Tstatus; Student:TStudent; typeStr:string;begininherited; if edt_stdNo.Text ='' then begin MessageBox(Handle, '没有可以修改的数据!', '信息', MB_ICONEXCLAMATION); exit; end else begin if((edt_stdNo.Text='')) then begin MessageBox(Handle, '内容填写不正确!', '信息', MB_ICONEXCLAMATION); exit; end; Student:=TStudent.Create; Student:=Control_StudentU.GetStudentByStudentNo(self.edt_stdNo.Text); if Student=nil then begin MessageBox(Handle, '学号填写不正确!', '信息', MB_ICONEXCLAMATION); edt_stdNo.SetFocus; exit; end; self.edt_oldClass.Text:=Student.ClassName; typeStr:=self.cbx_type.Text; if (typeStr='退学') or (typeStr='休学') then begin self.edt_newClass.Text:=''; self.edt_newSchool.Text:=''; end else begin if (typeStr='转学') then begin self.edt_newClass.Text:=''; end; if (typeStr='调班') then begin self.edt_newSchool.Text:=''; end; end;
Status:=TStatus.Create; Status.id:=self.edt_stdNo.Tag; Status.studentNo:=self.edt_stdNo.Text; Status.changeType:=self.cbx_type.Text; Status.changeDate:=self.edt_changeDate.Text; Status.oldClass:=self.edt_oldClass.Text; Status.newSchool:=self.edt_newSchool.Text; Status.newClass:=self.edt_newClass.Text; Status.reason:=self.Memo_reason.Text; Status.remark:=self.Memo_remark.Text;
if(Control_statusU.Editstatus(status)) then begin MessageBox(Handle, '修改成功!', '信息', MB_ICONASTERISK); //刷新内容 FillData; end else begin MessageBox(Handle, '修改失败!', '信息', MB_ICONEXCLAMATION); exit; end; self.edt_stdNo.SetFocus; end;end;
procedure Tfrm_status.DBGrid_infoCellClick(Column: TColumn);var typeStr:string;begin inherited;if self.DBGrid_info.Fields[0].IsNull then exit;typeStr:=self.DBGrid_info.Fields[2].Value;//变动类型if (typeStr='退学') or (typeStr='休学') then begin self.Lab_newclass.Visible:=false; self.edt_newClass.Visible:=false; self.lab_newSchool.Visible:=false; self.edt_newSchool.Visible:=false; end else begin if (typeStr='转学') then begin self.Lab_newclass.Visible:=false; self.edt_newClass.Visible:=false; self.lab_newSchool.Visible:=true; self.edt_newSchool.Visible:=true; end; if (typeStr='调班') then begin self.Lab_newclass.Visible:=true; self.edt_newClass.Visible:=true; self.lab_newSchool.Visible:=false; self.edt_newSchool.Visible:=false; end; end; self.edt_stdNo.Tag:=self.DBGrid_info.Fields[0].Value;//保存id self.edt_stdNo.Text:=self.DBGrid_info.Fields[1].Value; self.cbx_type.Text :=self.DBGrid_info.Fields[2].Value;
self.edt_changeDate.Text:=DatetoStr(self.DBGrid_info.Fields[3].Value); self.edt_oldClass.Text:=self.DBGrid_info.Fields[4].Value; self.edt_newSchool.Text:=self.DBGrid_info.Fields[5].Value; self.edt_newClass.Text:=self.DBGrid_info.Fields[6].Value; self.Memo_reason.Text:=self.DBGrid_info.Fields[7].Value; self.Memo_remark.Text:=self.DBGrid_info.Fields[8].Value;end;
procedure Tfrm_status.btn_search_stdNoClick(Sender: TObject);begin inherited; if self.edt_stdNo_s.Text='' then DataSource_info.DataSet:=Control_statusU.GetStatusArray else DataSource_info.DataSet:=GetStatusQueryByStdNo(self.edt_stdNo_s.Text); self.DBGrid_info.Columns[0].Visible :=false;end;frm_StudentU学生信息界面private stdNo:string;//保存当前学生证号 public //填充数据 procedure FillData;override; end;
procedure Tfrm_Student.FillData;begin DataSource_info.DataSet:=Control_StudentU.GetStudentArray; self.DBGrid_info.Columns[2].Visible :=false;//照片路径不可见 Control_classU.FillCombobox(self.cbx_class);end;
procedure Tfrm_Student.FormShow(Sender: TObject);begin inherited; FillData;end;
procedure Tfrm_Student.DBGrid_infoCellClick(Column: TColumn);var WorkPath:string;begin if self.DBGrid_info.Fields[0].IsNull then exit; stdNo:= self.DBGrid_info.Fields[0].Value;//保存当前学生证号 self.edt_studentNo.Text :=self.DBGrid_info.Fields[0].Value; self.edt_name.Text:=self.DBGrid_info.Fields[1].Value; //显示照片信息 WorkPath := ExtractFilePath(Application.ExeName); try self.image_pic.Picture.LoadFromFile(WorkPath+self.DBGrid_info.Fields[2].Value); except self.image_pic.Picture:=nil; end; self.cbx_sex.Text:=self.DBGrid_info.Fields[3].Value; self.edt_nation.Text:=self.DBGrid_info.Fields[4].Value; self.DTP_birthday.Date:=self.DBGrid_info.Fields[5].Value; self.edt_native.Text :=self.DBGrid_info.Fields[6].Value; self.edt_IDCard.Text:=self.DBGrid_info.Fields[7].Value; self.edt_hometel.Text:=self.DBGrid_info.Fields[8].Value; self.edt_address.Text:=self.DBGrid_info.Fields[9].Value; self.edt_postalcode.Text:=self.DBGrid_info.Fields[10].Value; self.DTP_indate.Date:=self.DBGrid_info.Fields[11].Value; self.cbx_class.Text:=self.DBGrid_info.Fields[12].Value; self.edt_duty.Text:=self.DBGrid_info.Fields[13].Value; self.Memo_remark.Text:=self.DBGrid_info.Fields[14].Value; inherited;end;
procedure Tfrm_Student.btn_addClick(Sender: TObject);var Student:TStudent; WorkPath:string;begin inherited; if((self.edt_studentNo.Text='') or (edt_Name.Text='') or (edt_nation.Text='') or (self.edt_native.Text='') or (edt_IDCard.Text='') or (self.edt_homeTel.Text='') or (edt_address.Text='') or (self.edt_postalcode.Text='') ) then begin MessageBox(Handle, '*为必填信息!', '信息', MB_ICONEXCLAMATION); exit; end; //查找是否存在重复 if (Control_StudentU.GetStudentByStudentNo(trim(edt_studentNo.Text)))<>nil then begin MessageBox(Handle, '该学号已经存在,请重新设置!', '信息', MB_ICONEXCLAMATION); exit; end; WorkPath := ExtractFilePath(Application.ExeName); Student:=TStudent.Create; Student.stdNo:=self.edt_studentNo.Text; Student.stdName:=self.edt_name.Text; Student.picPath:='photo\'+Student.stdNo+'.bmp'; Student.sex:=self.cbx_sex.Text; Student.nation:=self.edt_nation.Text; Student.birthday:=DateToStr(self.DTP_birthday.date); Student.native:=self.edt_native.Text; Student.IDCard:=self.edt_IDCard.Text; Student.homeTel:=self.edt_homeTel.Text; Student.address:=self.edt_address.Text; Student.postalcode:=self.edt_postalcode.Text; Student.inDate:=DateTostr(self.DTP_indate.Date); Student.ClassName:=self.cbx_class.Text; Student.duty:=self.edt_duty.Text; Student.remark:=self.Memo_remark.Text; if(Control_StudentU.AddStudent(Student)) then begin
self.image_pic.Picture.SaveToFile(WorkPath+Student.picPath); MessageBox(Handle, '添加成功!', '信息', MB_ICONASTERISK); //刷新内容 FillData; end else begin MessageBox(Handle, '添加失败!', '信息', MB_ICONEXCLAMATION); exit; end;
end;
procedure Tfrm_Student.btn_delClick(Sender: TObject);begin if MessageBox(Handle, '您确定要删除该学生信息', '信息', MB_ICONQUESTION or MB_OKCANCEL) = IDOK then begin Control_StudentU.DelStudent(self.edt_studentNo.Text); FillData; if self.DBGrid_info.Fields[0].IsNull then exit; self.edt_studentNo.Text :=self.DBGrid_info.Fields[0].Value; self.edt_name.Text:=self.DBGrid_info.Fields[1].Value; self.image_pic.Picture.LoadFromFile(self.DBGrid_info.Fields[2].Value); self.cbx_sex.Text:=self.DBGrid_info.Fields[3].Value; self.edt_nation.Text:=self.DBGrid_info.Fields[4].Value; self.DTP_birthday.Date:=self.DBGrid_info.Fields[5].Value; self.edt_native.Text :=self.DBGrid_info.Fields[6].Value; self.edt_IDCard.Text:=self.DBGrid_info.Fields[7].Value; self.edt_hometel.Text:=self.DBGrid_info.Fields[8].Value; self.edt_address.Text:=self.DBGrid_info.Fields[9].Value; self.edt_postalcode.Text:=self.DBGrid_info.Fields[10].Value; self.DTP_indate.Date:=self.DBGrid_info.Fields[11].Value; self.cbx_class.Text:=self.DBGrid_info.Fields[12].Value; self.edt_duty.Text:=self.DBGrid_info.Fields[13].Value; self.Memo_remark.Text:=self.DBGrid_info.Fields[14].Value; end;end;
procedure Tfrm_Student.btn_editClick(Sender: TObject);var Student:TStudent; WorkPath:string;begininherited; if edt_StudentNo.Text ='' then begin MessageBox(Handle, '没有可以修改的数据!', '信息', MB_ICONEXCLAMATION); exit; end else begin if((self.edt_studentNo.Text='') or (edt_Name.Text='') or (edt_nation.Text='') or (self.edt_native.Text='') or (edt_IDCard.Text='') or (self.edt_homeTel.Text='') or (edt_address.Text='') or (self.edt_postalcode.Text='') ) then begin MessageBox(Handle, '*为必填信息!', '信息', MB_ICONEXCLAMATION); exit; end; //查找是否存在重复 Student:=TStudent.Create; Student:=GetStudentByStudentNo(trim(edt_StudentNo.Text)); if(Student<>nil) then begin if(Student.stdNo<>stdNo) then begin MessageBox(Handle, '该学生证号已经存在,请重新设置!', '信息', MB_ICONEXCLAMATION); exit; end; end; WorkPath := ExtractFilePath(Application.ExeName); Student:=TStudent.Create; Student.stdNo:=self.edt_studentNo.Text; Student.stdName:=self.edt_name.Text; Student.picPath:='photo\'+Student.stdNo+'.bmp'; Student.sex:=self.cbx_sex.Text; Student.nation:=self.edt_nation.Text; Student.birthday:=DateToStr(self.DTP_birthday.date); Student.native:=self.edt_native.Text; Student.IDCard:=self.edt_IDCard.Text; Student.homeTel:=self.edt_homeTel.Text; Student.address:=self.edt_address.Text; Student.postalcode:=self.edt_postalcode.Text; Student.inDate:=DateTostr(self.DTP_indate.Date); Student.ClassName:=self.cbx_class.Text; Student.duty:=self.edt_duty.Text; Student.remark:=self.Memo_remark.Text; if(Control_StudentU.EditStudent(Student,stdNo)) then begin self.image_pic.Picture.SaveToFile(WorkPath+Student.picPath); MessageBox(Handle, '修改成功!', '信息', MB_ICONASTERISK); //刷新内容 FillData; end else begin MessageBox(Handle, '修改失败!', '信息', MB_ICONEXCLAMATION); exit; end; self.edt_StudentNo.SetFocus; end;end;
procedure Tfrm_Student.btn_search_nameClick(Sender: TObject);begin inherited;if self.edt_name_s.Text='' then self.FillDataelse begin self.DataSource_info.DataSet:= Control_StudentU.GetStudentByName(trim(self.edt_name_s.Text)); self.DBGrid_info.Columns[2].Visible :=false; end;end;
procedure Tfrm_Student.image_picClick(Sender: TObject);begin inherited; if self.OpenD_pic.Execute then begin image_pic.Picture.LoadFromFile(self.OpenD_pic.FileName ); end;end;
procedure Tfrm_Student.edt_postalcodeKeyPress(Sender: TObject; var Key: Char);begin inherited;if not((key in ['0'..'9',#8,#13])) then key:=#0;end;
procedure Tfrm_Student.btn_search_stdNoClick(Sender: TObject);begin inherited;if self.edt_stdNo_s.Text='' then self.FillDataelse begin self.DataSource_info.DataSet:= Control_StudentU.GetStudentQueryByStudentNo(trim(self.edt_stdNo_s.Text)); self.DBGrid_info.Columns[2].Visible :=false; end;end;