📄 b学期注册.frm
字号:
VERSION 5.00
Begin VB.Form B学期注册
Caption = "学期注册"
ClientHeight = 3765
ClientLeft = 60
ClientTop = 345
ClientWidth = 7620
LinkTopic = "Form1"
ScaleHeight = 3765
ScaleWidth = 7620
StartUpPosition = 3 'Windows Default
Begin VB.Frame Frame1
Caption = "学期注册"
Height = 3495
Left = 120
TabIndex = 0
Top = 120
Width = 7455
Begin VB.Frame Frame4
Caption = "操作"
Height = 3135
Left = 4560
TabIndex = 5
Top = 240
Width = 2775
Begin VB.CommandButton CmdExit
Caption = "退出"
Height = 375
Left = 840
TabIndex = 9
Top = 1800
Width = 1215
End
Begin VB.CommandButton CmdOldRegister
Caption = "注册"
Height = 375
Left = 840
TabIndex = 8
Top = 1320
Width = 1215
End
Begin VB.ComboBox CboRegister
Height = 315
Left = 720
TabIndex = 6
Top = 480
Width = 1815
End
Begin VB.Label Label1
Caption = "学期:"
Height = 375
Left = 120
TabIndex = 7
Top = 480
Width = 615
End
End
Begin VB.Frame Frame
Caption = "学生注册信息列表"
Height = 3135
Index = 1
Left = 2280
TabIndex = 3
Top = 240
Width = 2175
Begin VB.ListBox ListRegister
Height = 2790
Left = 120
TabIndex = 4
Top = 240
Width = 1935
End
End
Begin VB.Frame Frame
Caption = "学生列表"
Height = 3135
Index = 0
Left = 120
TabIndex = 1
Top = 240
Width = 2055
Begin VB.ListBox ListStu
Height = 2790
Left = 120
TabIndex = 2
Top = 240
Width = 1815
End
End
End
End
Attribute VB_Name = "B学期注册"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim SQL As String
Dim msg As String
Dim Index As Integer
Dim strClassNo As String
Private Sub FixData(stuNo As String)
Dim rst As ADODB.Recordset
'初始化学生注册信息ListBox
Frame(1).Caption = stuNo & "号学生注册信息"
SQL = " select * from 注册信息表 where 学号='"
SQL = SQL & stuNo & "'"
Set rst = SelectSQL(SQL, msg)
ListRegister.Clear
If rst.RecordCount > 0 Then
rst.MoveFirst
For Index = 1 To 8
If rst.Fields(Index) <> "" Then
strItem = "学期" & Str(Index) & " " & rst.Fields(Index)
Else
strItem = "学期" & Str(Index) & " 未注册"
End If
ListRegister.AddItem (strItem)
Next Index
rst.Close
ListRegister.ListIndex = 0
End If
End Sub
Private Sub CmdOldRegister_Click()
'得到学号和学期
Dim stuNo As String
Dim term As String
Dim date1 As String
stuNo = Left(Trim(ListStu.Text), 8)
term = "学期" & Trim(Str(CboRegister.ListIndex + 1))
date1 = Format(Now, "yyyy-mm-dd")
SQL = "update 注册信息表 set " & Trim(term) & "='" & Trim(date1) & "' where 学号='"
SQL = SQL & stuNo & "'"
Call ExecuteSQL(SQL, msg)
MsgBox (stuNo & "学生注册成功!")
Call FixData(stuNo)
End Sub
Private Sub Form_Load()
Dim rst As ADODB.Recordset
Dim strItem As String
'得到班号
strClassNo = B学生查询.strQuery
Frame(0).Caption = strClassNo & "班学生列表"
'初始化学生ListBox
SQL = " select 学号,姓名 from 学生基本信息表"
SQL = SQL & " where 班号='" & strClassNo & "' order by 学号"
Set rst = SelectSQL(SQL, msg)
If rst.RecordCount > 0 Then
Do While Not rst.EOF
strItem = rst.Fields(0) & " " & rst.Fields(1)
ListStu.AddItem (strItem)
rst.MoveNext
Loop
rst.Close
ListStu.ListIndex = 0
CmdOldRegister.Enabled = True
Else
MsgBox ("没有学生注册!")
CmdOldRegister.Enabled = False
Exit Sub
End If
'得到学生的注册信息
If ListStu.ListCount > 0 Then
Call FixData(Left(Trim(ListStu.Text), 8))
End If
'初始化学期ComboBox
For Index = 1 To 8
CboRegister.AddItem "第" & Str(Index) & "学期"
Next Index
CboRegister.ListIndex = 0
End Sub
Private Sub CmdExit_Click()
'退出操作
学生档案管理.Enabled = True
B学生查询.Enabled = True
Unload Me
End Sub
Private Sub ListStu_Click()
If ListStu.ListCount > 0 Then '得到学生注册信息
Call FixData(Left(Trim(ListStu.Text), 8))
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
'退出操作
学生档案管理.Enabled = True
B学生查询.Enabled = True
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -