📄 colcourse.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "colcourse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private mcolcourse As New Collection
Public Property Get count() As Long
count = mcolcourse.count
End Property
Public Sub add(tmpcourse As course)
mcolcourse.add tmpcourse
End Sub
Public Function remove(tmp_index As Integer) As Boolean
If mcolcourse.count >= 1 Then
mcolcourse.remove (tmp_index)
remove = True
Else
remove = False
End If
End Function
Public Function item(ByVal index As Variant) As course
Set item = mcolcourse.item(index)
End Function
Public Sub init()
Dim SQLstmt As String '存放SQL语句的字符串
Dim msg_error As String
Dim tmp_res As ADODB.Recordset
Dim tmp_course As course
If db.db_state > 0 Then
SQLstmt = "select * FROM course_info " '执行SQL语句"
Set tmp_res = db.ExecuteSQL(SQLstmt, msg_error)
If InStr(msg_error, "query_ok") > 0 Then 'have record
While (tmp_res.EOF = False)
Set tmp_course = New course
tmp_course.State = 1 '有 课程存在
tmp_course.course_no = tmp_res.Fields("course_no")
tmp_course.course_name = tmp_res.Fields("course_name")
tmp_course.course_type = tmp_res.Fields("course_type")
tmp_course.course_des = tmp_res.Fields("course_des")
mcolcourse.add tmp_course
Set tmp_course = Nothing
tmp_res.MoveNext
Wend
End If
End If
Set tmp_res = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -