📄 classedit.frm
字号:
If kkx.yesno = False Then Exit Sub
nn = kkx.kk
main.connect.Execute "update [xb] set [xn]='" & nn & "' where [ID]=" & Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1)
TreeView1.SelectedItem.Text = nn & "系"
Case "Z"
Dim kkz As New addxi
kkz.Caption = "修改专业"
kkz.Label1 = "请修改专业的名称(&M)"
kkz.Label2.Visible = False
kkz.Label1.Top = kkz.Label1.Top - 1000
kkz.Text1.Top = kkz.Text1.Top - 1400
kkz.Command2.Top = kkz.Command2.Top - 1300
kkz.Command4.Top = kkz.Command4.Top - 1300
kkz.Height = kkz.Height - 1300
kkz.Picture1.Height = kkz.Height - 400
kkz.Text1.Text = Left(TreeView1.SelectedItem.Text, Len(TreeView1.SelectedItem.Text) - 2)
kkz.Show 1
If kkz.yesno = False Then Exit Sub
nn = kkz.kk
main.connect.Execute "update [zy] set [zyname]='" & nn & "' where [ID]=" & Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1)
TreeView1.SelectedItem.Text = nn & "专业"
Case "N"
Dim kkn As New addyear
kkn.Caption = "修改年级"
kkn.Label1 = "请修改年级(&M)"
kkn.Label2.Visible = False
kkn.Text1.Width = 2700
kkn.UpDown1.Left = 4400
kkn.Text1.Text = Left(TreeView1.SelectedItem.Text, Len(TreeView1.SelectedItem.Text) - 1)
kkn.Show 1
If kkn.yesno = False Then Exit Sub
nn = kkn.kk
main.connect.Execute "update [yc] set [yna]='" & nn & "' where [ID]=" & Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1)
TreeView1.SelectedItem.Text = nn & "级"
Case "B"
Dim kkb As New addclass
kkb.Caption = "修改班级"
kkb.Label1.Caption = "请修改班级(&M)"
kkb.Text1.Text = Left(TreeView1.SelectedItem.Text, Len(TreeView1.SelectedItem.Text) - 1)
kkb.Show 1
If kkb.yesno = False Then Exit Sub
nn = kkb.kk
main.connect.Execute "update [class] set [na]='" & nn & "' where [ID]=" & Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1)
TreeView1.SelectedItem.Text = nn & "班"
End Select
End Sub
Private Sub Command2_Click()
'添加案件
Dim nodX As Node
Dim temp As New ADODB.Recordset
b = Left(TreeView1.SelectedItem.Key, 1)
Select Case b
Case "R"
Dim kk As New addxi
kk.Show 1
If kk.yesno = False Then Exit Sub
nn = kk.kk
main.connect.Execute "insert into [xb]([xn]) values('" & nn & "')"
temp.Open "select * from [xb] ", main.connect, 3, 2
temp.MoveLast
Set nodX = TreeView1.Nodes.Add("R", tvwChild, "X" & temp.Fields(0), temp.Fields(1) & "系", 2)
Case "X"
Dim kk1 As New addxi
kk1.Caption = "添加专业"
kk1.Label2.Visible = False
kk1.Label1.Top = kk1.Label1.Top - 1000
kk1.Text1.Top = kk1.Text1.Top - 1400
kk1.Command2.Top = kk1.Command2.Top - 1300
kk1.Command4.Top = kk1.Command4.Top - 1300
kk1.Height = kk1.Height - 1300
kk1.Picture1.Height = kk1.Height - 400
kk1.Label1.Caption = "请输入给" & TreeView1.SelectedItem.Text & "所加专业的名称(&M)"
kk1.Show 1
If kk1.yesno = False Then Exit Sub
nn = kk1.kk
main.connect.Execute "insert into [zy]([zyname],[xid]) values('" & nn & "'," & Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1) & ")"
temp.Open "select * from [zy] ", main.connect, 3, 2
temp.MoveLast
Set nodX = TreeView1.Nodes.Add(TreeView1.SelectedItem.Key, tvwChild, "Z" & temp.Fields(0), temp.Fields(1) & "专业", 3)
Case "Z"
Dim kk3 As New addyear
kk3.Label2.Visible = False
kk3.Text1.Width = 2700
kk3.UpDown1.Left = 4400
yy = Year(Now)
If Month(Now) < 8 Then yy = yy - 1
kk3.Text1.Text = yy
kk3.Show 1
If kk3.yesno = False Then Exit Sub
nn = kk3.kk
main.connect.Execute "insert into [yc]([yna],[zyid]) values('" & nn & "'," & Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1) & ")"
temp.Open "select * from [yc] ", main.connect, 3, 2
temp.MoveLast
Set nodX = TreeView1.Nodes.Add(TreeView1.SelectedItem.Key, tvwChild, "N" & temp.Fields(0), temp.Fields(1) & "级", 4)
Case "N"
Dim kk4 As New addclass
kk4.Show 1
If kk4.yesno = False Then Exit Sub
nn = kk4.kk
main.connect.Execute "insert into [class]([na],[yid]) values('" & nn & "'," & Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1) & ")"
temp.Open "select * from [class] ", main.connect, 3, 2
temp.MoveLast
Set nodX = TreeView1.Nodes.Add(TreeView1.SelectedItem.Key, tvwChild, "B" & temp.Fields(0), temp.Fields(1) & "班", 5)
Case "B"
Dim ff2 As New studentedit
ff2.nn = Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1)
ff2.kk = TreeView1.SelectedItem.Parent.Parent.Parent.Text & TreeView1.SelectedItem.Parent.Parent.Text & TreeView1.SelectedItem.Parent.Text & TreeView1.SelectedItem.Text
Unload Me
ff2.Show 1
End Select
End Sub
Private Sub Command3_Click()
'删除案件
Dim nodX As Node
Dim temp As New ADODB.Recordset
b = Left(TreeView1.SelectedItem.Key, 1)
Select Case b
Case "R"
Case "X"
temp.Open "select * from [zy] where [xid]=" & Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1), main.connect, 3, 2
If temp.RecordCount = 0 Then
temp.Close
main.connect.Execute "Delete from [xb] where [ID]=" & Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1)
TreeView1.Nodes.Remove TreeView1.SelectedItem.Index
Call TreeView1_NodeClick(TreeView1.SelectedItem)
Else
temp.Close
MsgBox "此系部下仍有专业,不能删除。" & Chr(13) & Chr(10) & "如要删除此系部,请先删除所含的专业。", vbOKOnly Or vbInformation, "提示"
Exit Sub
End If
Case "Z"
temp.Open "select * from [yc] where [zyid]=" & Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1), main.connect, 3, 2
If temp.RecordCount = 0 Then
temp.Close
main.connect.Execute "Delete from [zy] where [ID]=" & Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1)
TreeView1.Nodes.Remove TreeView1.SelectedItem.Index
Call TreeView1_NodeClick(TreeView1.SelectedItem)
Else
temp.Close
MsgBox "此专业下仍有年级,不能删除。" & Chr(13) & Chr(10) & "如要删除此专业,请先删除所含的年级。", vbOKOnly Or vbInformation, "提示"
Exit Sub
End If
Case "N"
temp.Open "select * from [class] where [yid]=" & Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1), main.connect, 3, 2
If temp.RecordCount = 0 Then
temp.Close
main.connect.Execute "Delete from [yc] where [ID]=" & Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1)
TreeView1.Nodes.Remove TreeView1.SelectedItem.Index
Call TreeView1_NodeClick(TreeView1.SelectedItem)
Else
temp.Close
MsgBox "此年级下仍有班级,不能删除。" & Chr(13) & Chr(10) & "如要删除此年级,请先删除所含的班级。", vbOKOnly Or vbInformation, "提示"
Exit Sub
End If
Case "B"
temp.Open "select * from [student] where [clasid]=" & Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1), main.connect, 3, 2
If temp.RecordCount = 0 Then
temp.Close
main.connect.Execute "Delete from [class] where [ID]=" & Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1)
TreeView1.Nodes.Remove TreeView1.SelectedItem.Index
Call TreeView1_NodeClick(TreeView1.SelectedItem)
Else
temp.Close
MsgBox "此班级下仍有学生,不能删除。" & Chr(13) & Chr(10) & "如要删除此班级,请先删除所含的学生,或进行结业处理。", vbOKOnly Or vbInformation, "提示"
Exit Sub
End If
End Select
End Sub
Private Sub Form_Load()
'初始窗体
Dim nodX As Node
Set nodX = TreeView1.Nodes.Add(, , "R", "西安科技学院", 1)
Dim xu As New ADODB.Recordset
Dim zy As New ADODB.Recordset
Dim nj As New ADODB.Recordset
Dim ban As New ADODB.Recordset
xu.Open "select * from [xb]", main.connect, 3, 2
Label3.Caption = "共有" & xu.RecordCount & "个系"
For i = 1 To xu.RecordCount
Set nodX = TreeView1.Nodes.Add("R", tvwChild, "X" & xu.Fields(0), xu.Fields(1) & "系", 2)
zy.Open "select * from [zy] where [xid]=" & xu.Fields(0), main.connect, 3, 2
For i1 = 1 To zy.RecordCount
Set nodX = TreeView1.Nodes.Add("X" & xu.Fields(0), tvwChild, "Z" & zy.Fields(0), zy.Fields(1) & "专业", 3)
nj.Open "select * from [yc] where [zyid]=" & zy.Fields(0), main.connect, 3, 2
For i2 = 1 To nj.RecordCount
Set nodX = TreeView1.Nodes.Add("Z" & zy.Fields(0), tvwChild, "N" & nj.Fields(0), nj.Fields(1) & "级", 4)
ban.Open "select * from [class] where [yid]=" & nj.Fields(0), main.connect, 3, 2
For i3 = 1 To ban.RecordCount
Set nodX = TreeView1.Nodes.Add("N" & nj.Fields(0), tvwChild, "B" & ban.Fields(0), ban.Fields(1) & "班", 5)
ban.MoveNext
Next
ban.Close
nj.MoveNext
Next
nj.Close
zy.MoveNext
Next
zy.Close
xu.MoveNext
Next
SendKeys "{RIGHT}"
End Sub
Private Sub Form_Resize()
'改变窗体大小
On Error Resume Next
Picture1.Height = Me.Height - Picture2.Height - 500
Picture2.Top = Picture1.Height + 70
TreeView1.Height = Picture1.Height
TreeView1.Width = Me.Width - Picture1.Width - 250
Picture2.Left = Me.Width - Picture2.Width - 300
End Sub
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
'单击时间
a = Left(Node.Key, 1)
Dim temp As New ADODB.Recordset
Select Case a
Case "R"
'院校点绩
temp.Open "select * from [xb]", main.connect, 3, 2
Label2.Caption = "西安科技学院"
Label3.Caption = "共有" & temp.RecordCount & "个系"
temp.Close
temp.Open "select * from [zy]", main.connect, 3, 2
Label3.Caption = Label3.Caption & Chr(13) & Chr(10) & "共有" & temp.RecordCount & "个专业"
temp.Close
temp.Open "select * from [yc]", main.connect, 3, 2
Label3.Caption = Label3.Caption & Chr(13) & Chr(10) & "共有" & temp.RecordCount & "个年级"
temp.Close
temp.Open "select * from [class]", main.connect, 3, 2
Label3.Caption = Label3.Caption & Chr(13) & Chr(10) & "共有" & temp.RecordCount & "个班级"
temp.Close
temp.Open "select * from [student]", main.connect, 3, 2
Label3.Caption = Label3.Caption & Chr(13) & Chr(10) & "共有" & temp.RecordCount & "名学生"
temp.Close
Command2.Caption = "无法操作(&M)"
Command2.Enabled = False
Command4.Caption = "无法操作(&M)"
Command4.Enabled = False
Command3.Caption = "无法操作(&D)"
Command3.Enabled = False
Case "X"
'系点绩
b = Right(Node.Key, Len(Node.Key) - 1)
temp.Open "select * from [zy] where [xid]=" & b, main.connect, 3, 2
Label2.Caption = Node.Text
Label3.Caption = "共有" & temp.RecordCount & "个专业"
temp.Close
temp.Open "select * from [yc]", main.connect, 3, 2
Label3.Caption = Label3.Caption & Chr(13) & Chr(10) & "共有" & temp.RecordCount & "个年级"
temp.Close
temp.Open "select * from [class]", main.connect, 3, 2
Label3.Caption = Label3.Caption & Chr(13) & Chr(10) & "共有" & temp.RecordCount & "个班级"
temp.Close
temp.Open "select * from [student]", main.connect, 3, 2
Label3.Caption = Label3.Caption & Chr(13) & Chr(10) & "共有" & temp.RecordCount & "名学生"
temp.Close
Command2.Caption = "添加专业(&A)"
Command2.Enabled = True
Command4.Caption = "无法操作(&M)"
Command4.Enabled = False
Command3.Caption = "无法操作(&D)"
Command3.Enabled = False
Case "Z"
b = Right(Node.Key, Len(Node.Key) - 1)
temp.Open "select * from [yc] where [zyid]=" & b, main.connect, 3, 2
Label2.Caption = Node.Parent.Text & Node.Text
Label3.Caption = "共有" & temp.RecordCount & "个年级"
temp.Close
temp.Open "select * from [class] where [yid] in (select [ID] from [yc] where [zyid]=" & b & ")", main.connect, 3, 2
Label3.Caption = Label3.Caption & Chr(13) & Chr(10) & "共有" & temp.RecordCount & "个班级"
temp.Close
temp.Open "select * from [student] where [clasid] in (select [ID] from [class] where [yid] in (select [ID] from [yc] where [zyid]=" & b & "))", main.connect, 3, 2
Label3.Caption = Label3.Caption & Chr(13) & Chr(10) & "共有" & temp.RecordCount & "名学生"
temp.Close
Command2.Caption = "添加年级(&A)"
Command2.Enabled = True
Command4.Caption = "修改专业(&M)"
Command4.Enabled = True
Command3.Caption = "删除专业(&D)"
Command3.Enabled = True
Case "N"
b = Right(Node.Key, Len(Node.Key) - 1)
temp.Open "select * from [class] where [yid]=" & b, main.connect, 3, 2
Label2.Caption = Node.Parent.Parent.Text & Node.Parent.Text & Node.Text
Label4.Caption = "所含班级数目"
Label3.Caption = "共有" & temp.RecordCount & "个班级"
temp.Close
temp.Open "select * from [student] where [clasid] in (select [ID] from [class] where [yid]=" & b & ")", main.connect, 3, 2
Label3.Caption = Label3.Caption & Chr(13) & Chr(10) & "共有" & temp.RecordCount & "名学生"
temp.Close
Command2.Caption = "添加班级(&A)"
Command2.Enabled = True
Command4.Caption = "修改年级(&M)"
Command4.Enabled = True
Command3.Caption = "删除年级(&D)"
Command3.Enabled = True
Case "B"
b = Right(Node.Key, Len(Node.Key) - 1)
temp.Open "select * from [student] where [clasid]=" & b, main.connect, 3, 2
Label2.Caption = Node.Parent.Parent.Parent.Text & Node.Parent.Parent.Text & Node.Parent.Text & Node.Text
Label4.Caption = "所含学生人数目"
Label3.Caption = "共有" & temp.RecordCount & "名学生"
temp.Close
Command2.Caption = "学生名册处理(&A)"
Command2.Enabled = True
Command4.Caption = "修改班级(&M)"
Command4.Enabled = True
Command3.Caption = "删除班级(&D)"
Command3.Enabled = True
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -