【VB开源代码栏目提醒】:网学会员VB开源代码为您提供B学期注册.frm参考,解决您在B学期注册.frm学习中工作中的难题,参考学习。
VERSION 5.00
Begin VB.Form frmSemesterReg
Caption = "学期注册"
ClientHeight = 4965
ClientLeft = 6000
ClientTop = 3420
ClientWidth = 6300
LinkTopic = "Form1"
ScaleHeight = 4965
ScaleWidth = 6300
Begin VB.CommandButton CmdExit
Caption = "退出"
Height = 435
Left = 4680
TabIndex = 8
Top = 4320
Width = 1035
End
Begin VB.Frame Frame
Caption = "学生列表"
Height = 3195
Index = 0
Left = 0
TabIndex = 6
Top = 0
Width = 2655
Begin VB.ListBox ListStu
Height = 2760
Left = 120
TabIndex = 7
Top = 240
Width = 1815
End
End
Begin VB.Frame Frame
Caption = "学生注册信息列表"
Height = 3135
Index = 1
Left = 3000
TabIndex = 4
Top = 0
Width = 2535
Begin VB.ListBox ListRegister
Height = 2760
Left = 120
TabIndex = 5
Top = 240
Width = 1935
End
End
Begin VB.Frame Frame4
Caption = "操作"
Height = 915
Left = 0
TabIndex = 0
Top = 3240
Width = 5535
Begin VB.ComboBox CboRegister
Height = 315
Left = 840
TabIndex = 2
Top = 240
Width = 1815
End
Begin VB.CommandButton CmdOldRegister
Caption = "注册"
Height = 495
Left = 3660
TabIndex = 1
Top = 300
Width = 1455
End
Begin VB.Label Label1
Caption = "学期:"
Height = 375
Left = 120
TabIndex = 3
Top = 240
Width = 615
End
End
End
Attribute VB_Name = "frmSemesterReg"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim SQLStr As String
Dim msg As String
Dim Index As Integer
Dim strClassNo As String
Private Sub FixData(StNumber As String)
Dim rst As ADODB.Recordset
'初始化学生注册信息ListBox
Frame(1).Caption = StNumber & "号学生注册信息"
SQLStr = " select * from 注册信息表 where number='"
SQLStr = SQLStr & StNumber & "'"
Set rst = SelectSQL(SQLStr, 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 StNumber As String
Dim term As String
Dim date1 As String
StNumber = Left(Trim(ListStu.Text), 8)
term = "term" & Trim(Str(CboRegister.ListIndex + 1))
date1 = Format(Now, "yyyy-mm-dd")
SQLStr = "update 注册信息表 set " & Trim(term) & "='" & Trim(date1) & "' where number='"
SQLStr = SQLStr & StNumber & "'"
Call ExecuteSQL(SQLStr, msg)
MsgBox (StNumber & "学生注册成功!")
Call FixData(StNumber)
End Sub
Private Sub Form_Load()
Dim rst As ADODB.Recordset
Dim strItem As String
'得到班号
strClassNo = frmStQuery.strQuery
Frame(0).Caption = strClassNo & "班学生列表"
'初始化学生ListBox
SQLStr = " select number,nameSt from 学生基本信息表"
SQLStr = SQLStr & " where classID='" & strClassNo & "' order by number"
Set rst = SelectSQL(SQLStr, 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()
'退出操作
frmMain.Enabled = True
frmStQuery.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)
'退出操作
frmMain.Enabled = True
frmStQuery.Enabled = True
Unload Me
End Sub
上一篇:
CShow_2Doc.cpp
下一篇:
基于消费者社会化视角的儿童消费者影响因素研究