📄 mdiform1.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.MDIForm MDIForm1
BackColor = &H8000000C&
Caption = "学生选课系统 Version 1.0.0"
ClientHeight = 4395
ClientLeft = 165
ClientTop = 855
ClientWidth = 7125
Icon = "MDIForm1.frx":0000
LinkTopic = "MDIForm1"
Picture = "MDIForm1.frx":27A2
StartUpPosition = 3 'Windows Default
WindowState = 2 'Maximized
Begin MSComDlg.CommonDialog CommonDialog1
Left = 1200
Top = 600
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 300
Left = 0
TabIndex = 0
Top = 4095
Width = 7125
_ExtentX = 12568
_ExtentY = 529
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 6
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 6
Alignment = 1
Object.Width = 1765
MinWidth = 1765
TextSave = "18/06/2004"
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 5
Alignment = 1
Object.Width = 1764
MinWidth = 1764
TextSave = "2:10"
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 3177
MinWidth = 3177
EndProperty
BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 2999
MinWidth = 2999
EndProperty
BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Bevel = 2
Object.Width = 89
MinWidth = 89
EndProperty
BeginProperty Panel6 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 1
EndProperty
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Menu m_system
Caption = "系统(&S)"
Begin VB.Menu m_user
Caption = "用户管理"
Shortcut = ^U
End
Begin VB.Menu m_1
Caption = "-"
End
Begin VB.Menu m_initial
Caption = "初试化数据"
End
Begin VB.Menu m_backup
Caption = "备份数据"
End
Begin VB.Menu m_restore
Caption = "恢复数据"
End
Begin VB.Menu m_bar1
Caption = "-"
End
Begin VB.Menu m_logout
Caption = "注销"
End
Begin VB.Menu m_exit
Caption = "退出"
End
End
Begin VB.Menu M2
Caption = "选课(&L)"
Begin VB.Menu m_student
Caption = "学生信息管理"
End
Begin VB.Menu m_course
Caption = "课程信息管理"
End
Begin VB.Menu m_teacher
Caption = "教师信息管理"
End
Begin VB.Menu m_ct
Caption = "教师选课"
End
Begin VB.Menu m_choice
Caption = "学生选课"
End
End
Begin VB.Menu m_q
Caption = "查询(&Q)"
Begin VB.Menu m_stuquery
Caption = "学生选课查询"
End
Begin VB.Menu m_teacherquery
Caption = "教师查询"
End
End
Begin VB.Menu m_report
Caption = "报表(&R)"
Begin VB.Menu m_chart
Caption = "图表"
End
Begin VB.Menu m_print
Caption = "打印报表"
Visible = 0 'False
End
End
Begin VB.Menu m_help
Caption = "帮助(&H)"
Begin VB.Menu m_about
Caption = "关于"
End
End
End
Attribute VB_Name = "MDIForm1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub m_backup_Click()
'针对sqlserver 2000后台数据库
'使用CommonDialog控件保存备份文件
Dim bakfile As String
CommonDialog1.Filter = "备份文件(*.bak)|*.bak"
CommonDialog1.ShowSave
bakfile = CommonDialog1.FileName
If bakfile = "" Then
MsgBox "文件名输入不合法!请按“确定”返回", vbExclamation
Exit Sub
Else
Set con = New ADODB.Connection
con.ConnectionString = ConnectionString
con.CursorLocation = adUseClient
con.CommandTimeout = 300
On Error GoTo error_proc
con.Open
Dim s2 As String
s2 = "BACKUP DATABASE stu TO DISK='" & bakfile & "'"
Dim com1 As ADODB.Command
Set com1 = New ADODB.Command
com1.ActiveConnection = con
com1.CommandText = s2
com1.CommandType = adCmdText
com1.Execute
MsgBox "数据备份完毕,请按“确定”返回", vbInformation, "完成"
Exit Sub
End If
error_proc:
MsgBox "备份数据时出现错误!" & vbNewLine & Err.Description, vbExclamation, "错误"
End Sub
Private Sub m_restore_Click()
'针对sqlserver 2000后台数据库
Dim bakfile As String
CommonDialog1.Filter = "备份文件(*.bak)|*.bak"
CommonDialog1.ShowOpen
bakfile = CommonDialog1.FileName
If bakfile = "" Or Dir(bakfile) = "" Then
MsgBox "文件不存在,请重新选择。", vbExclamation
Exit Sub
Else
Dim s2 As String
s2 = "RESTORE DATABASE STU FROM DISK = '" & bakfile & "'"
On Error GoTo error_proc
Dim com1 As ADODB.Command
Set com1 = New ADODB.Command
com1.ActiveConnection = con
com1.CommandText = s2
com1.CommandType = adCmdText
com1.Execute
MsgBox "数据还原完毕,请按“确定”返回", vbInformation, "完毕"
Exit Sub
End If
error_proc:
MsgBox "还原数据库时出现错误!" & vbNewLine & Err.Description, vbExclamation, "错误"
End Sub
Private Sub m_initial_Click()
Dim str As String
Dim rs As ADODB.Recordset
Dim intAnswer As Integer
intAnswer = MsgBox("真的要初始化数据吗?请确认!", vbOKCancel + vbQuestion, "确认框")
If intAnswer = vbOK Then
str = "DELETE FROM choice"
con.Execute str
MsgBox "数据初始化完毕,请按“确定”返回", vbInformation
End If
End Sub
Private Sub m_about_Click()
About_frm.Show
End Sub
Private Sub m_chart_Click()
'chart_frm.Show
End Sub
Private Sub m_choice_Click()
s_choice_frm.Show
End Sub
Private Sub m_course_Click()
course_frm.Show
End Sub
Private Sub m_ct_Click()
t_choice_frm.Show
End Sub
Private Sub m_exit_Click()
Unload Me
End Sub
Private Sub m_student_Click()
student_frm.Show
End Sub
Private Sub m_stuquery_Click()
s_choice_frm.Show
End Sub
Private Sub m_teacher_Click()
teacher_frm.Show
End Sub
Private Sub m_teacherquery_Click()
query_frm.Show
End Sub
Private Sub m_user_Click()
user_frm.Show
End Sub
Private Sub m_print_Click()
DataEnvironment1.Connection1.ConnectionString = ConnectionString
DataReport2.Show
End Sub
Private Sub MDIForm_Load()
MDIForm1.WindowState = 2
StatusBar1.Panels(3).Text = "当前用户:" & UserName
StatusBar1.Panels(4).Text = "权限:" & Right1
StatusBar1.Panels(6).Text = "提示信息..."
If MsgBox("当前系统时间:" & Now(), vbOKCancel, "核对") = vbCancel Then
End
End If
End Sub
Private Sub m_logout_Click()
If MsgBox("确定要注销吗?", vbQuestion + vbOKCancel, "注销") = vbOK Then
Unload MDIForm1
Call Main
End If
End Sub
Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim r
r = MsgBox("确定要退出吗?", vbQuestion + vbOKCancel, "退出系统")
If r = vbCancel Then
Cancel = True
End If
End Sub
Private Sub MDIForm_Unload(Cancel As Integer)
Dim Frm As Form
For Each Frm In Forms
Unload Frm
Set Frm = Nothing
Next Frm
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -