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

📄 rec.cls

📁 这是一个航空公司用来计算货物运价的系统。
💻 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 = "REC"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'此模块用于存放所有的对数据库的操作
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'****************************************************************************
'函数名 SEL0
'作  用 综合型运价数据的查询
'输入参数 货物编码【hwbm】 运价类新【yjlx】 起始站【qsz】 到达站【ddz】 承运人【cys】
'返回值 记录集
'作  者 blue
'日  期 2000-12-20
'****************************************************************************
Public Function sel0(ByVal hwbm As String, ByVal yjlx As String, ByVal qsz As String, ByVal ddz As String, ByVal cys As String) As ADODB.Recordset
    On Error GoTo HANDLE
    Dim CON As New ADODB.Connection
    Dim RS As New ADODB.Recordset
    Dim SQL, SQL0 As String 'SQL0作为临时的条件限制SQL语句
    
    CON.ConnectionString = CONSTRING1
    CON.CursorLocation = adUseClient
    CON.Open
    
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'生成临时SQL语句SQL0
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    '货物编码
    If hwbm <> "" Then
    SQL0 = "gsno='" & hwbm & "'"
    End If
    '运价类型
    If yjlx <> "" Then
    If SQL0 <> "" Then
    SQL0 = SQL0 & "and fflag='" & yjlx & "'"
    Else
    SQL0 = "fflag='" & yjlx & "'"
    End If
    End If
    '起始站
    If qsz <> "" Then
    If SQL0 <> "" Then
    SQL0 = SQL0 & "and dep='" & qsz & "'"
    Else
    SQL0 = "dep='" & qsz & "'"
    End If
    End If
    '到达站
    If ddz <> "" Then
    If SQL0 <> "" Then
    SQL0 = SQL0 & "and dest='" & ddz & "'"
    Else
    SQL0 = "dest='" & ddz & "'"
    End If
    End If
    '承运商
    If cys <> "" Then
    If SQL0 <> "" Then
    SQL0 = SQL0 & "and carrier='" & cys & "'"
    Else
    SQL0 = "carrier='" & cys & "'"
    End If
    End If
    
    '初始SQL语句
    SQL = "select * from tbl_fare_bz"
    
    '最终SQL语句得生成
    If SQL0 <> "" Then
    SQL = SQL & "where" & SQL0
    End If
    
    RS.Open SQL, CON, adOpenForwardOnly, adLockReadOnly
    Set SELECT_INFODC1 = RS
    GetObjectContext.SetComplete
OVER:
    SQL = ""
    SQL0 = ""
    Set RS = Nothing
    Set CON = Nothing
Exit Function
HANDLE:
    GetObjectContext.SetAbort
    Err.Raise Err.Number, "db.rec.sel0", Err.Description
    Resume OVER
End Function

⌨️ 快捷键说明

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