📄 form5.frm
字号:
VERSION 5.00
Begin VB.Form Form5
Caption = "Form5"
ClientHeight = 1875
ClientLeft = 60
ClientTop = 345
ClientWidth = 3000
LinkTopic = "Form5"
ScaleHeight = 1875
ScaleWidth = 3000
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 360
TabIndex = 4
Top = 1200
Width = 2415
End
Begin VB.ComboBox classCombox
Height = 315
Left = 1320
TabIndex = 3
Top = 720
Width = 1455
End
Begin VB.ComboBox gradeCombox
Height = 315
Left = 1320
TabIndex = 1
Top = 240
Width = 1455
End
Begin VB.Label Label1
Caption = "班级"
Height = 255
Index = 1
Left = 360
TabIndex = 2
Top = 720
Width = 735
End
Begin VB.Label Label1
Caption = "年级"
Height = 255
Index = 0
Left = 360
TabIndex = 0
Top = 240
Width = 735
End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'临时课表
Dim ctCon As ADODB.Connection
Dim ctrs As ADODB.Recordset
'classArray表
Dim cacon As ADODB.Connection
Dim cars As ADODB.Recordset
Dim sqlStr As String
Dim ClassCode As String
Dim wStr(5) As String
Private Sub clearStr()
For i = 1 To 5
wStr(i) = " "
Next i
End Sub
Private Sub Update_ct()
'删除所有以前的记录
ctCon.Execute ("delete * from tempCT")
'更新表
sqlStr = "select * from classArray where cclasscode='" & ClassCode & "'" & " order by iTimeN"
cacon.Execute sqlStr
cars.Open sqlStr, cacon, adOpenStatic, adLockOptimistic
cars.MoveFirst
Dim i As Integer
i = 1
clearStr
While (Not cars.EOF)
While cars!iTimeN <> i
'添加一条课程记录
strSql = "insert into tempCT values(" & i & " ," + "'" + wStr(1) + "' ," + "'" + wStr(2) + "' ," + "'" + wStr(3) + "' ," + "'" + wStr(4) + "' ," + "'" + wStr(5) + "' )"
ctCon.Execute strSql
clearStr
i = i + 1
Wend
wStr(cars!iTimew) = cars!csjname
cars.MoveNext
Wend
'添加一条课程记录
strSql = "insert into tempCT values(" & i & " ," + "'" + wStr(1) + "' ," + "'" + wStr(2) + "' ," + "'" + wStr(3) + "' ," + "'" + wStr(4) + "' ," + "'" + wStr(5) + "' )"
ctCon.Execute strSql
clearStr
While i < 10
'添加一条课程记录
strSql = "insert into tempCT values(" & i & " ," + "'" + wStr(1) + "' ," + "'" + wStr(2) + "' ," + "'" + wStr(3) + "' ," + "'" + wStr(4) + "' ," + "'" + wStr(5) + "' )"
ctCon.Execute strSql
i = i + 1
Wend
End Sub
Private Sub Command1_Click()
ClassCode = Trim(gradeCombox.Text) & "." & Trim(classCombox.Text)
Call Update_ct
Unload Me
classRep.Show
End Sub
Private Sub Form_Load()
For i = 1 To 12
gradeCombox.AddItem (i)
Next i
For i = 1 To 20
classCombox.AddItem (i)
Next i
Set cacon = New ADODB.Connection
Set cars = New ADODB.Recordset
cacon.Open "provider=Microsoft.Jet.OLEDB.4.0; data source= " & App.Path & "\dataUse.mdb"
Set ctCon = New ADODB.Connection
Set ctrs = New ADODB.Recordset
ctCon.Open "provider=Microsoft.Jet.OLEDB.4.0; data source= " & App.Path & "\dataUse.mdb"
End Sub
Private Sub Form_Unload(Cancel As Integer)
cars.Close
cacon.Close
Set cars = Nothing
Set cacon = Nothing
ctCon.Close
Set ctrs = Nothing
Set ctCon = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -