学生管理系统开发文档
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
学生管理系统开发文档
【概述】
该系统要求实现的功能是,对学生的住宿情况进行记录管理,要求记录学生的基本信、宿舍的基本信息和学生与宿舍的对应关系;其中学生的信息包括学生姓名、学号、班级、联系电话,宿舍的基本信息包括房间号码、宿舍电话和该宿舍所在的楼号,宿舍和学生的对应关系则记录某个学生住在哪一个宿舍。
要求系统能对这些信息进行动态地查询、修改和删除操作。
【数据库设计】
首先是进行数据库的设计。
根据系统的要求,建立E-R图:
根据该E-R图创建数据库——学生住宿管理,在该数据库中建立三个表:stu、dom、s_d,这三个表的设置分别为:
然后在数据库中加入触发器,以便在对数据库里的数据进行更新的时候相应的表里的数据能实现联动,以保持其完整性。
create trigger tri_alter
on stu for update
as
declare @sno1 char(8),@sno2 char(8)
set @sno1=(select 学号from deleted)
set @sno2=(select 学号from inserted)
update s_d set 学号=@sno2 where 学号=@sno1
create trigger tri_alter2
on dom for update
as
declare @dte1 char(11),@dte2 char(11)
set @dte1=(select 宿舍电话from deleted)
set @dte2=(select 宿舍电话from inserted)
update s_d set 宿舍电话=@dte2 where 宿舍电话=@dte1
create trigger delete1
on stu for delete
as
declare @sno char(8)
set @sno=(select 学号from deleted)
delete s_d where 学号=@sno
create trigger delete2
on dom for delete
as
declare @dte char(11)
set @dte=(select 宿舍电话from deleted)
delete s_d where 宿舍电话=@dte
然后在这三个表中添加一些测试信息,检查数据库能否正确运行。
【程序设计】
接着是程序的编写。
程序共需要五个窗体,其中一个登陆窗体、一个关于本程序的介绍窗体和三个主窗体,这三个主窗体分别用来实现对数据库数据的浏览、编辑、删除操作,各窗体的切换用菜单的形式实现,首先绘制出各个窗体:登陆窗体:
系统介绍窗体:
数据浏览窗体:
数据编辑窗体:
数据删除窗体:
然后是编写代码,为了对数据进行保护,系统预先设置了两个用户身份,分别为administrator和gust ,其中administrator能对数据进行所有操作,而gust 只能浏览数据而不能编辑和删除,用户在使用中可以自由切换身份。
各窗体代码分别为:
'logon窗体代码
'班级:自动化053(原信息0514)
'姓名:凌小峰
'学号:40550415
Public userid As Integer '身份标识
Const user1 As String = "administrator" '用户名和密码
Const pass1 As String = "iamyourmaster"
Const user2 As String = "gust"
Const pass2 As String = "canivisityou"
Private Sub Command1_Click() '点击确定以后的处理过程
If Trim(Text1.Text) <> "" And Trim(Text2.Text) <> "" Then '判断用户名和密码是否已经输入
If Trim(Text1.Text) = user1 And Trim(Text2.Text) = pass1 Then '如果是管理员登陆
Me.Hide
MsgBox "欢迎你,administrator!您可以对数据进行任何操作!"
mainpage.Show
userid = 1 '对身分标识进行标记
ElseIf Trim(Text1.Text) = user2 And Trim(Text2.Text) = pass2 Then '如果是gust 登陆
Me.Hide
MsgBox "欢迎你,gust!您可以进行浏览操作!"
mainpage.Show
userid = 0 '对身份表示进行标记
Else '如果输入的用户名和密码错误
Text1.Text = ""
Text2.Text = ""
MsgBox "对不起,您输入的用户名或密码错误,请重新输入!"
End If
Else
MsgBox "请输入用户名和密码!"
End If
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Command2_Click() '点击重置以后的处理过程
Text1.Text = ""
Text2.Text = ""
userid = 0
Select Case (Int(Rnd * 4)) '通过产生随机数来决定输入密码是显示的符号
Case 0
Text2.PasswordChar = "*"
Case 1
Text2.PasswordChar = "@"
Case 2
Text2.PasswordChar = "#"
Case 3
Text2.PasswordChar = "$"
End Select
End Sub
Private Sub Command3_Click() '如果用户忘记了用户名和密码,可以进行提示MsgBox "user:administrator,password:iamyourmaster" & vbNewLine & "user:gust,password:canivisityou"
End Sub
Private Sub Form_Load()
MsgBox "本程序原作者:凌小峰" & vbNewLine & "班级:自053" & vbNewLine & "学号:40550415" '为防止盗版,特此申明
Select Case (Int(Rnd * 4)) '通过产生随机数来决定输入密码是显示的符号
Case 0
Text2.PasswordChar = "*"
Case 1
Text2.PasswordChar = "@"
Case 2
Text2.PasswordChar = "#"
Case 3
Text2.PasswordChar = "$"
End Select
Text1.Text = "" '初始化输入文本框
Text2.Text = ""
userid = 0 '初始化身分标识
'mainpage窗体代码
Dim cond, tabl, colum As String '定义这些量用来记录执行查询操作是需要用到的信息
Private Sub aboutthis_Click() '点击"关于学生管理系统"菜单时显示about页about.Show
End Sub
Private Sub change_Click() '点击""切换用户操作时
userid = 0 '身份标识设为初始值
Me.Hide '当前页隐藏
logon.Show '显示登陆页面
End Sub
Private Sub Command1_Click() '点击"查询"按钮
cond = "1=1 "
If Trim(Text1.Text) <> "" Then cond = cond + "and 姓名='" + Trim(Text1.Text) + "' " '检查各文本框状态,如果有输入则将其列入查询条件之中
If Trim(Text2.Text) <> "" Then cond = cond + "and stu.学号='" + Trim(Text2.Text) + "' "
If Trim(Text3.Text) <> "" Then cond = cond + "and 班级='" + Trim(Text3.Text) + "' " If Trim(Text4.Text) <> "" Then cond = cond + "and 联系电话='" + Trim(Text4.Text) + "' "
If Trim(Text5.Text) <> "" Then cond = cond + "and 房间号码='" + Trim(Text5.Text) + "' "
If Trim(Text6.Text) <> "" Then cond = cond + "and dom.宿舍电话='" + Trim(Text6.Text) + "' "
If Trim(Text7.Text) <> "" Then cond = cond + "and 楼号='" + Trim(Text7.Text) + "' " On Error Resume Next
Adodc2.RecordSource = "select " + colum + " from " + tabl + " where " + cond '依据各种查询条件进行查询
Adodc2.Refresh '执行查询操作
DataGrid2.Refresh
Text1.Text = "" '将各文本框初始化
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
End Sub
Private Sub context_Click() '点击"帮主主题"菜单时
MsgBox "您的计算机中未找到该系统的帮助文件,请先装载该文件." '显示提示信息
End Sub
Private Sub delete_Click() '点击"删除数据"菜单时
If erid = 1 Then '通过判断用户标识判断当前用户是否有权执行该操作Me.Hide
deletepage.Show
Else
MsgBox "对不起,您没有权限执行该操作,如果您确实要执行该操作,请切换用户至administrator!"
End If
End Sub
Private Sub edit_Click() '点击"编辑数据"菜单时
If erid = 1 Then '通过判断用户标识来判断当前用户是否有权限执行该操作
Me.Hide
editpage.Show
Else
MsgBox "对不起,您没有权限执行该操作,如果您确实要执行该操作,请切换用户至administrator!"
End If
End Sub
Private Sub exit_Click() '点击"退出"菜单时
End '结束程序
End Sub
Private Sub Form_Load() '程序初始化
tabl = "stu" '默认表设为stu表
Call showtexts '对各个文本框进行初始化设置
cond = "1=1 " '查询条件设为1=1 ,即查询全部
End Sub
Private Sub logout_Click() '点击"注销"菜单时
userid = 0 '用户标识设为初始值
mainpage.Hide '隐藏当前页
logon.Show '显示登陆页面
End Sub
Private Sub Option1_Click() '点击"学生信息"单选框
Adodc1.RecordSource = "select * from stu" '查询stu表信息
tabl = "stu" '设置tabl的值为stu
Adodc1.Refresh '执行查询
DataGrid1.Caption = "学生信息"
DataGrid1.Refresh
Call showtexts '重置各个文本框的设置
colum = "*"
End Sub
Private Sub Option2_Click() '点击"宿舍信息"单选框
Adodc1.RecordSource = "select * from dom" '查询dom表信息
tabl = "dom" '设置tabl的值为dom
Adodc1.Refresh '执行查询
DataGrid1.Caption = "宿舍信息"
DataGrid1.Refresh
Call showtexts '重置各文本框的设置
colum = "*"
End Sub
Private Sub Option3_Click() '点击"住宿情况"单选框
Adodc1.RecordSource = "select 姓名,stu.学号,班级,联系电话,房间号码,楼号,dom.宿舍电话from stu inner join s_d on stu.学号= s_d.学号inner join dom on s_d.宿舍电话=dom.宿舍电话" '综合查询各表信息
tabl = "stu inner join s_d on stu.学号= s_d.学号inner join dom on s_d.宿舍电话=dom.宿舍电话" '记录当前信息源
Adodc1.Refresh '执行查询
DataGrid1.Caption = "居住信息"
DataGrid1.Refresh
Call showtexts '重置各文本框设置
colum = "姓名,stu.学号,班级,联系电话,房间号码,楼号,dom.宿舍电话" '记录当前列
End Sub
Private Sub read_Click() '点击"浏览数据"菜单时
Me.Hide
mainpage.Show
End Sub
Private Sub showtexts() '各文本框重置过程
If Option1.Value = True Then '通过判断当前选中的单选框来决定操作
Label1.Visible = True
Text1.Visible = True
Label2.Visible = True
Text2.Visible = True
Label3.Visible = True
Text3.Visible = True
Label4.Visible = True
Text4.Visible = True
Label5.Visible = False
Text5.Visible = False
Label6.Visible = False
Text6.Visible = False
Label7.Visible = False
Text7.Visible = False
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
colum = "*"
ElseIf Option2.Value = True Then'如果当前单选框为宿舍信息
Label1.Visible = False
Text1.Visible = False
Label2.Visible = False
Text2.Visible = False
Label3.Visible = False
Text3.Visible = False
Label4.Visible = False
Text4.Visible = False
Label5.Visible = True
Text5.Visible = True
Label6.Visible = True
Text6.Visible = True
Label7.Visible = True
Text7.Visible = True
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
colum = "*"
Else '如果当前单选框为住宿情况
Label1.Visible = True
Text1.Visible = True
Label2.Visible = True
Text2.Visible = True
Label3.Visible = True
Text3.Visible = True
Label4.Visible = True
Text4.Visible = True
Label5.Visible = True
Text5.Visible = True
Label6.Visible = True
Text6.Visible = True
Label7.Visible = True
Text7.Visible = True
colum = "姓名,stu.学号,班级,联系电话,房间号码,楼号,dom.宿舍电话"
End If
Text1.Text = "" '清空各文本框
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
End Sub
Dim cond, tabl, colum As String '定义一些变量来记录查询条件和执行插入操作时所需信息
Dim db As New ADODB.Connection '定义该量用来执行插入操作
Private Sub aboutthis_Click() '点击"关于学生住宿管理系统"菜单时
about.Show
End Sub
Private Sub change_Click() '点击"切换用户"菜单时
userid = 0
Me.Hide '隐藏当前页
logon.Show '显示登陆页面
End Sub
Private Sub Command1_Click() '点击"查询"按钮
cond = "1=1 "
If Trim(Text1.Text) <> "" Then cond = cond + "and 姓名='" + Trim(Text1.Text) + "' " '将输入的条件列入查询条件之中
If Trim(Text2.Text) <> "" Then cond = cond + "and stu.学号='" + Trim(Text2.Text) + "' "
If Trim(Text3.Text) <> "" Then cond = cond + "and 班级='" + Trim(Text3.Text) + "' " If Trim(Text4.Text) <> "" Then cond = cond + "and 联系电话='" + Trim(Text4.Text) + "' "
If Trim(Text5.Text) <> "" Then cond = cond + "and 房间号码='" + Trim(Text5.Text) + "' "
If Trim(Text6.Text) <> "" Then cond = cond + "and dom.宿舍电话='" + Trim(Text6.Text) + "' "
If Trim(Text7.Text) <> "" Then cond = cond + "and 楼号='" + Trim(Text7.Text) + "' " On Error Resume Next
Adodc1.RecordSource = "select " + colum + " from " + tabl + " where " + cond '设置好查询语句
Adodc1.Refresh '执行查询操作
DataGrid1.Refresh
End Sub
Private Sub Command2_Click() '点击"修改"按钮时
On Error Resume Next
Adodc1.Recordset.Update '修改数据
'Adodc1.Recordset.MoveNext
DataGrid1.Refresh
Adodc1.Refresh '更新显示数据
End Sub
Private Sub Command3_Click() '点击"清空"按钮
Text1.Text = "" '将各文本框内容清空
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
'Command2.Enabled = False
'Command4.Enabled = False
End Sub
Private Sub Command4_Click() '点击"插入"按钮时
'On Error Resume Next
If Option1.Value = True Then '如果当前使用的表是stu表进行相应的插入操作
If Trim(Text2.Text) <> "" Then db.Execute "insert into stu values('" + Text1.Text + "','" + Text2.Text + "','" + Text3.Text + "','" + Text4.Text + "')"
End If
If Option2.Value = True Then '如果当前使用的是dom表,执行相应的操作
If Trim(Text6.Text) <> "" Then db.Execute "insert into dom values('" + Text5.Text + "','" + Text6.Text + "','" + Text7.Text + "')"
End If
If Option3.Value = True Then '如果当前表是s_d表,执行相应的操作
If Trim(Text2.Text) <> "" And Trim(Text6.Text) <> "" Then
db.Execute "insert into stu values('" + Text1.Text + "','" + Text2.Text + "','" + Text3.Text + "','" + Text4.Text + "')"
db.Execute "insert into dom values('" + Text5.Text + "','" + Text6.Text + "','" + Text7.Text + "')"
End If
End If
End Sub
Private Sub context_Click() '点击"帮助主题"菜单时
MsgBox "您的计算机中未找到该系统的帮助文件,请先装载该文件."
End Sub
Private Sub delete_Click() '点击"删除数据"时
If erid = 1 Then '通过判断用户标识来判断当前用户是否有权限执行该操作
Me.Hide
deletepage.Show
Else
MsgBox "对不起,您没有权限执行该操作,如果您确实要执行该操作,请切换用户至administrator!"
End If
End Sub
Private Sub edit_Click() '点击"编辑数据"菜单时
If erid = 1 Then '通过判断用户标识来判断当前用户是否有权限执行该操作
Me.Hide
editpage.Show
Else
MsgBox "对不起,您没有权限执行该操作,如果您确实要执行该操作,请切换用户至administrator!"
End If
End Sub
Private Sub exit_Click() '点击"退出"菜单时
End '结束程序
End Sub
Private Sub Form_Load() '窗体初始化
db.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=学生住宿管理;Data Source=." '初始化db属性设置
db.Open '打开数据库
tabl = "stu" '默认表设置为stu
Adodc1.RecordSource = "select * from stu"
Adodc1.Refresh
DataGrid1.Caption = "学生信息"
DataGrid1.Refresh
Call showtexts '各文本框设置初始化
End Sub
Private Sub logout_Click() '点击"注销"菜单时
userid = 0
mainpage.Hide
logon.Show
End Sub
Private Sub Option1_Click() '点击"学生信息"单选框时
Adodc1.RecordSource = "select * from stu" '设置信息源
Adodc1.Refresh '重新显示
On Error Resume Next
Call showtexts '初始化各文本框设置
DataGrid1.Caption = "学生信息"
'DataGrid1.Refresh
tabl = "stu" '记录使用的表
colum = "*" '记录使用的列
End Sub
Private Sub Option2_Click() '点击"宿舍信息"单选框时
Adodc1.RecordSource = "select * from dom" '设置信息源
Adodc1.Refresh '重新显示
On Error Resume Next
Call showtexts '初始化各文本框设置
DataGrid1.Caption = "宿舍信息"
'DataGrid1.Refresh
colum = "*" '记录当前使用的列
tabl = "dom" '记录当前使用的表
End Sub
Private Sub Option3_Click() '点击"住宿情况"单选框时
Adodc1.RecordSource = "select 姓名,stu.学号,班级,联系电话,房间号码,楼号,dom.宿舍电话from stu inner join s_d on stu.学号= s_d.学号inner join dom on s_d.宿舍电话=dom.宿舍电话" '设置信息源
tabl = "stu inner join s_d on stu.学号= s_d.学号inner join dom on s_d.宿舍电话=dom.宿舍电话" '记录当前使用的信息源
Adodc1.Refresh '重新显示
On Error Resume Next
Call showtexts '初始化各文本框设置
DataGrid1.Caption = "居住信息"
'DataGrid1.Refresh
colum = "姓名,stu.学号,班级,联系电话,房间号码,楼号,dom.宿舍电话" '记录当前使用的列
End Sub
Private Sub read_Click() '点击"浏览数据"菜单时
Me.Hide
mainpage.Show
End Sub
Private Sub showtexts() '文本框初始化过程
If Option1.Value = True Then '在当前选中文本框不同时执行不同的操作,当前为"学生信息时"
Label1.Visible = True
Text1.Visible = True
Label2.Visible = True
Text2.Visible = True
Label3.Visible = True
Text3.Visible = True
Label4.Visible = True
Text4.Visible = True
Text1.DataField = "姓名"
Text2.DataField = "学号"
Text3.DataField = "班级"
Text4.DataField = "联系电话"
Text5.DataField = ""
Text6.DataField = ""
Text7.DataField = ""
Label5.Visible = False
Text5.Visible = False
Label6.Visible = False
Text6.Visible = False
Label7.Visible = False
Text7.Visible = False
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
colum = "*"
ElseIf Option2.Value = True Then '当前为"宿舍信息"时Label5.Visible = True
Text5.Visible = True
Label6.Visible = True
Text6.Visible = True
Label7.Visible = True
Text7.Visible = True
Text1.DataField = ""
Text2.DataField = ""
Text3.DataField = ""
Text4.DataField = ""
Text5.DataField = "房间号码"
Text6.DataField = "宿舍电话"
Text7.DataField = "楼号"
Label1.Visible = False
Text1.Visible = False
Label2.Visible = False
Text2.Visible = False
Label3.Visible = False
Text3.Visible = False
Label4.Visible = False
Text4.Visible = False
colum = "*"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Else '当前为"住宿情况"时
Label1.Visible = True
Text1.Visible = True
Label2.Visible = True
Text2.Visible = True
Label3.Visible = True
Text3.Visible = True
Label4.Visible = True
Text4.Visible = True
Label5.Visible = True
Text5.Visible = True
Label6.Visible = True
Text6.Visible = True
Label7.Visible = True
Text7.Visible = True
colum = "姓名,stu.学号,班级,联系电话,房间号码,楼号,dom.宿舍电话"
Text1.DataField = "姓名"
Text2.DataField = "学号"
Text3.DataField = "班级"
Text4.DataField = "联系电话"
Text5.DataField = "房间号码"
Text6.DataField = "宿舍电话"
Text7.DataField = "楼号"
End If
Dim cond, tabl, colum As String '定义这些变量用来记录查询所需信息
Private Sub aboutthis_Click() '点击"关于学生住宿管理系统"菜单时
about.Show
End Sub
Private Sub change_Click() '点击"切换用户"菜单时
userid = 0
Me.Hide
logon.Show
End Sub
Private Sub Command1_Click() '点击"查询"时
cond = "1=1 "
If Trim(Text1.Text) <> "" Then cond = cond + "and 姓名='" + Trim(Text1.Text) + "' "
'如果某文本框中输入有内容,则以此为查询条件
If Trim(Text2.Text) <> "" Then cond = cond + "and stu.学号='" + Trim(Text2.Text) + "' "
If Trim(Text3.Text) <> "" Then cond = cond + "and 班级='" + Trim(Text3.Text) + "' " If Trim(Text4.Text) <> "" Then cond = cond + "and 联系电话='" + Trim(Text4.Text) + "' "
If Trim(Text5.Text) <> "" Then cond = cond + "and 房间号码='" + Trim(Text5.Text) + "' "
If Trim(Text6.Text) <> "" Then cond = cond + "and dom.宿舍电话='" + Trim(Text6.Text) + "' "
If Trim(Text7.Text) <> "" Then cond = cond + "and 楼号='" + Trim(Text7.Text) + "' " On Error Resume Next
Adodc1.RecordSource = "select " + colum + " from " + tabl + " where " + cond '进行查询设置
Adodc1.Refresh '执行查询操作
DataGrid1.Refresh
End Sub
Private Sub Command2_Click() '点击"删除"按钮
On Error Resume Next
Adodc1.Recordset.delete '删除当前内容
End Sub
Private Sub context_Click() '点击"帮助主题"菜单
MsgBox "您的计算机中未找到该系统的帮助文件,请先装载该文件."
End Sub
Private Sub edit_Click() '点击"编辑数据"菜单
If erid = 1 Then
Me.Hide
editpage.Show
Else
MsgBox "对不起,您没有权限执行该操作,如果您确实要执行该操作,请切换用户至administrator!"
End If
End Sub
Private Sub exit_Click() '点击"退出"菜单
End
End Sub
Private Sub Form_Load() '窗体加载时初始化
tabl = "stu"
Adodc1.RecordSource = "select * from stu"
Adodc1.Refresh
DataGrid1.Caption = "学生信息"
DataGrid1.Refresh
Call showtexts
End Sub
Private Sub logout_Click() '点击"注销"菜单
userid = 0
mainpage.Hide
logon.Show
End Sub
Private Sub Option1_Click() '点击"学生信息"单选框时(与editpage相同)
Adodc1.RecordSource = "select * from stu"
Adodc1.Refresh
On Error Resume Next
Call showtexts
DataGrid1.Caption = "学生信息"
'DataGrid1.Refresh
tabl = "stu"
colum = "*"
End Sub
Private Sub Option2_Click() '点击"宿舍信息"单选框时(与editpage相同)
Adodc1.RecordSource = "select * from dom"
Adodc1.Refresh
On Error Resume Next
Call showtexts
DataGrid1.Caption = "宿舍信息"
'DataGrid1.Refresh
colum = "*"
tabl = "dom"
End Sub
Private Sub Option3_Click() '点击"住宿情况"单选框时(与editpage相同)
Adodc1.RecordSource = "select 姓名,stu.学号,班级,联系电话,房间号码,楼号,dom.宿舍电话from stu inner join s_d on stu.学号= s_d.学号inner join dom on s_d.宿舍电话=dom.宿舍电话"
tabl = "stu inner join s_d on stu.学号= s_d.学号inner join dom on s_d.宿舍电话=dom.宿舍电话"
Adodc1.Refresh
On Error Resume Next
Call showtexts
DataGrid1.Caption = "居住信息"
'DataGrid1.Refresh
colum = "姓名,stu.学号,班级,联系电话,房间号码,楼号,dom.宿舍电话" End Sub
Private Sub read_Click() '点击"浏览数据"菜单时
Me.Hide
mainpage.Show
End Sub
Private Sub showtexts() '文本框初始化过程
If Option1.Value = True Then
Label1.Visible = True
Text1.Visible = True
Label2.Visible = True
Text2.Visible = True
Label3.Visible = True
Text3.Visible = True
Label4.Visible = True
Text4.Visible = True
Text1.DataField = "姓名"
Text2.DataField = "学号"
Text3.DataField = "班级"
Text4.DataField = "联系电话"
Text5.DataField = ""
Text6.DataField = ""
Text7.DataField = ""
Label5.Visible = False
Text5.Visible = False
Label6.Visible = False
Text6.Visible = False
Label7.Visible = False
Text7.Visible = False
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
colum = "*"
ElseIf Option2.Value = True Then
Label5.Visible = True
Text5.Visible = True
Label6.Visible = True
Text6.Visible = True
Label7.Visible = True
Text7.Visible = True
Text1.DataField = ""
Text2.DataField = ""
Text3.DataField = ""
Text4.DataField = ""
Text5.DataField = "房间号码"
Text6.DataField = "宿舍电话"
Text7.DataField = "楼号"
Label1.Visible = False
Text1.Visible = False
Label2.Visible = False
Text2.Visible = False
Label3.Visible = False
Text3.Visible = False
Label4.Visible = False
Text4.Visible = False
colum = "*"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Else
Label1.Visible = True
Text1.Visible = True
Label2.Visible = True
Text2.Visible = True
Label3.Visible = True
Text3.Visible = True
Label4.Visible = True
Text4.Visible = True
Label5.Visible = True
Text5.Visible = True
Label6.Visible = True
Text6.Visible = True
Label7.Visible = True
Text7.Visible = True
colum = "姓名,stu.学号,班级,联系电话,房间号码,楼号,dom.宿舍电话" Text1.DataField = "姓名"
Text2.DataField = "学号"
Text3.DataField = "班级"
Text4.DataField = "联系电话"
Text5.DataField = "房间号码"
Text6.DataField = "宿舍电话"
Text7.DataField = "楼号"
End If
'about窗体代码
Dim tri As Integer
Private Sub Command1_Click() '点击"确定"时
Me.Hide '隐藏该窗体
End Sub
Private Sub Command2_Click()'tri作为软开关用来判断是进行显示操作还是隐藏If tri = 0 Then '显示数据库里触发器内容
tri = 1
Me.Height = 5220
Else '隐藏数据库里触发器内容
tri = 0
Me.Height = 3765
End If
End Sub
Private Sub Form_Load()'初始化窗体
tri = 0
Me.Height = 3765
Label3.Caption = "该学生宿舍管理系统作为一个课程作业,内容多有纰漏."
End Sub
最后测试程序是否能正确运行,是否能正确执行相关要求,实现所要求的功能.。