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

📄 openrs_cls.cls

📁 VB 设计的排课管理系统,轻松解决排课难的问题!
💻 CLS
字号:
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 1  'vbDataSource
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "OpenRs"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private rsSims As ADODB.Recordset                  '声明一个连接'记录集
Public rs1 As New ADODB.Recordset                      '声明一个连接到所需表的记录集
Public rs2 As New ADODB.Recordset
Public rst As New ADODB.Recordset
Private Data As Object
'---------------------------------------------------------
' 在类初始化时建立连接
'---------------------------------------------------------
'---------------------------------------------------------
'data是一个指向ADO记录集的对象的引用
'用于设置class的数据源内容
'---------------------------------------------------------
Private Sub Class_GetDataMember(DataMember As String, Data As Object)
    Set Data = rsSims
End Sub

'-------------------------------------------------------
'建立一个可以打开记录集的函数,需要是必须把表名传给函数
'-------------------------------------------------------
Public Function rsDK(Table As String)
    With rsSims
    .Source = Table
    .ActiveConnection = cnn
    .CursorType = adOpenKeyset
    .LockType = adLockOptimistic
    .Open , , , , adCmdTable
    End With
End Function
'-------------------------------------------------------
'建立一个可以打开记录集(动态游标)的函数
'需要把SQL语句传递给函数
'-------------------------------------------------------
Public Function rsDK1(sql As String)
Set rs1 = cnn.Execute(sql)
End Function
'-------------------------------------------------------
'建立一个可以打开记录集(静态游标)的函数
'需要把SQL语句传递给函数
'-------------------------------------------------------
Public Function rsDK2(sql As String)
Set rs2 = cnn.Execute(sql)
End Function

'-------------------------------------------------------
'类终止时,释放一切可能占据的资源
'-------------------------------------------------------
Private Sub Class_Terminate()
    Set rs1 = Nothing
    Set rs2 = Nothing
    Set rsSims = Nothing
    Set rst = Nothing
End Sub


⌨️ 快捷键说明

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