📄 kcdbdhs.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 = "KcDbdhs"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'QQ:75347626
'MSN:whailin2000@hotmail.com
Option Explicit
Dim oKcDbdhs As Collection
Public Property Get Name() As String
Name = "KcDbdhs"
End Property
Private Sub Class_Initialize()
Set oKcDbdhs = New Collection
End Sub
Public Sub Add(oKcDbdh As KcDbdh, Optional Needsave As Integer = 1)
Dim mKey As Integer
Dim vKcDbdh As KcDbdh
For Each vKcDbdh In oKcDbdhs
If mKey < vKcDbdh.KcDbdhKey Then
mKey = vKcDbdh.KcDbdhKey
End If
Next
oKcDbdh.KcDbdhKey = mKey + 1
If Needsave = 1 Then
oKcDbdh.Save
End If
oKcDbdhs.Add Item:=oKcDbdh, Key:=CStr(mKey + 1)
End Sub
Public Sub Remove(Vindex, Optional Needdel As Integer = 1)
Dim oKcDbdh As KcDbdh
Set oKcDbdh = Item(Vindex)
If Needdel = 1 And oKcDbdh.KcDbdhId = 1 Then
oKcDbdh.Del
End If
oKcDbdhs.Remove (Vindex)
Set oKcDbdh = Nothing
End Sub
Public Property Get Count() As Integer
Count = oKcDbdhs.Count
End Property
Public Function Item(Vindex) As KcDbdh
Attribute Item.VB_UserMemId = 0
Set Item = oKcDbdhs.Item(Vindex)
End Function
Public Sub ClearAll()
Dim I, Vcount As Integer
Vcount = oKcDbdhs.Count
For I = 1 To Vcount
oKcDbdhs.Remove (1)
Next
End Sub
Public Sub Fillbydb(Optional vWhereStr As String = "")
Dim oKcDbdh As KcDbdh
Dim Rs As ADODB.Recordset
Dim mKey As Integer
Dim mSqlStr As String
On Error GoTo Errorhandle
ClearAll
mSqlStr = "SELECT KCDBDHDOCNO,KCDBDHDAT,KCDBDHSYSDAT,KCDBDHSYSTIME,KCDBDHNO FROM KCDBDHREC "
If vWhereStr <> "" Then
mSqlStr = mSqlStr & " WHERE " & vWhereStr
End If
mSqlStr = mSqlStr & " ORDER BY KcDbdHDOCNO"
Set Rs = Conn.Execute(mSqlStr)
mKey = 1
Do Until Rs.EOF
Set oKcDbdh = New KcDbdh
oKcDbdh.KcDbdhKey = mKey
oKcDbdh.BatchLet Rs!KcDbdhDocno, Rs!KcDbdhDat, Rs!KcDbdhSysDat, Rs!KcDbdhSysTime, Rs!KcDbdhNo
oKcDbdhs.Add Item:=oKcDbdh, Key:=CStr(mKey)
Rs.MoveNext
mKey = mKey + 1
Loop
Rs.Close
Set Rs = Nothing
Exit Sub
Errorhandle:
If Not Rs Is Nothing Then
Rs.Close
End If
Set Rs = Nothing
Err.Raise vbObjectError + 1, , Err.Description
End Sub
Public Function NewEnum() As IUnknown
Attribute NewEnum.VB_UserMemId = -4
Attribute NewEnum.VB_MemberFlags = "40"
Set NewEnum = oKcDbdhs.[_NewEnum]
End Function
Private Sub Class_Terminate()
ClearAll
Set oKcDbdhs = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -