⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 colstudent.cls

📁 VB类实现学生信息管理系统
💻 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 = "colstudent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private mcolstudent As New Collection
    
Public Property Get count() As Long
count = mcolstudent.count
End Property

Public Sub add(tmpstudent As student)
   mcolstudent.add tmpstudent
End Sub

Public Function remove(tmp_index As Integer) As Boolean
   If mcolstudent.count >= 1 Then
      mcolstudent.remove (tmp_index)
      remove = True
   Else
      remove = False
   End If
End Function

Public Function item(ByVal index As Variant) As student
Set item = mcolstudent.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_student As student
  
  
  If db.db_state > 0 Then
  
    SQLstmt = "select b.director,a.student_id,a.student_name,a.student_sex,a.born_date,a.class_no,a.tele_number,a.ru_date,a.address,a.comment FROM student_info a,class_info b " '执行SQL语句"
    SQLstmt = SQLstmt + "where a.class_no=b.class_no"
    'MsgBox SQLstmt
    Set tmp_res = db.ExecuteSQL(SQLstmt, msg_error)
    
    
    
    If InStr(msg_error, "query_ok") > 0 Then 'have record
        While (tmp_res.EOF = False)
            If Trim(tmp_res.Fields("director")) = login_user.user_Id Or login_user.user_Id = "admin" Then '只有对应的班主任或是admin才能访问
                     Set tmp_student = New student
                     tmp_student.State = 1 '有学生存在
                     tmp_student.student_Id = tmp_res.Fields("student_id")
                     tmp_student.student_Name = tmp_res.Fields("student_Name")
                     tmp_student.student_Sex = tmp_res.Fields("student_sex")
                     tmp_student.born_date = tmp_res.Fields("born_date")
                     tmp_student.class_no = tmp_res.Fields("class_no")
                     tmp_student.tele_number = tmp_res.Fields("tele_number")
                     tmp_student.ru_date = tmp_res.Fields("ru_date")
                     tmp_student.address = tmp_res.Fields("address")
                     tmp_student.comment = tmp_res.Fields("comment")
                     mcolstudent.add tmp_student
                     Set tmp_student = Nothing
             End If
             tmp_res.MoveNext
         Wend
    
    End If
   
 End If
 
     Set tmp_res = Nothing
    
End Sub


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -