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

📄 clsservice.cls

📁 售票管理信息系统.my sql,visual basic
💻 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 = "clsService"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Public txtSQL As String
Dim mrc As ADODB.Recordset
Public Sub ShowData(ByVal msgList As MSFlexGrid)
     Dim j As Integer
    Dim i As Integer
    Dim MsgText As String
    Set mrc = ExecuteSQL(txtSQL, MsgText)
        With msgList
        .Rows = 1
        Do While Not mrc.EOF
            .Rows = .Rows + 1
            For i = 1 To mrc.Fields.Count - 1
                If Not IsNull(Trim(mrc.Fields(i - 1))) Then
                Select Case mrc.Fields(i - 1).Type
                    Case adDBDate
                        .TextMatrix(.Rows - 1, i) = Format(mrc.Fields(i - 1) & "", "yyyy-mm-dd")
                    Case Else
                        .TextMatrix(.Rows - 1, i) = mrc.Fields(i - 1) & ""
                End Select
                End If
            Next i
            mrc.MoveNext
            
        Loop
    End With
    mrc.Close
End Sub
Public Sub Save(txtString() As String)
    Dim intCount As Integer
    Dim MsgText As String
    '添加判断是否有相同的ID记录
 
    
    
     '添加判断是否有相同的ID记录
    If gintSmode = 1 Then
        txtSQL = "select * from serviceInfo where serviceNO='" & Trim(txtString(0)) & "'"
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        If mrc.EOF = False Then
            MsgBox "已经存在此编号的记录!", vbOKOnly + vbExclamation, "警告"
            txtItem(0).SetFocus
            Exit Sub
        End If
        mrc.Close
    End If
    '判断是否有相同内容的记录
    
     txtSQL = "select * from serviceInfo where serviceNO<>'" & Trim(txtString(0)) & "' and serviceName='" & Trim(txtString(1)) & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    If mrc.EOF = False Then
        MsgBox "已经存在相同机舱等级的记录!", vbOKOnly + vbExclamation, "警告"
        txtItem(1).SetFocus
        Exit Sub
    End If
    '先删除已有记录
    txtSQL = "delete from serviceInfo where serviceNO='" & Trim(txtString(0)) & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    '再加入新记录
    txtSQL = "select * from serviceInfo"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    mrc.AddNew
    For intCount = 0 To 1
        mrc.Fields(intCount) = txtString(intCount)
    Next intCount
    For intCount = 0 To 7
        mrc.Fields(intCount + 2) = txtString(intCount)
    Next intCount
    mrc.Fields(10) = Trim(txtItem(2))
    mrc.Update
    mrc.Close
End Sub
Public Sub Delete(ByVal msgList As MSFlexGrid)
    Dim txtSQL As String
    Dim intCount As Integer
    Dim mrc As ADODB.Recordset
    Dim MsgText As String
    intCount = msgList.Row
    txtSQL = "delete from serviceInfo where serviceNO ='" & Trim(msgList.TextMatrix(intCount, 1)) & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    txtSQL = "select * from serviceInfo"
End Sub

⌨️ 快捷键说明

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