注册 登录
编程论坛 VB6论坛

根据车辆上的有效日期, 判断若是与当前日期相差30天,则提示预警(方法中保留此判断,预警方式目前未定); 超过有效日期,则自动将有效标志变为 N;

黄某某某人 发布于 2018-04-25 17:44, 953 次点击
    Public Function DecideVehicle() As Boolean
        Dim bResult As Boolean = False

        Dim oMT As New AWSvcMain.MTVehicle
        Dim strOrderSQL As String = ""
        strOrderSQL = "select MTVehicle.VehicleNo,* from MTVehicle  where datediff(dd,EffectiveDate,getdate())=30"
        Dim rs As ADODB.Recordset = G_objService.DB_ExecSelectSQL(strOrderSQL)
        If rs.EOF = False Then
            oMT.SetService(G_objService)
            Dim strKey As String
            Dim strSQL As String = ""
            strSQL = "select * from MTVehicle where datediff(dd,EffectiveDate,getdate())>30"
            Dim rs1 As ADODB.Recordset = G_objService.DB_ExecSelectSQL(strSQL)
            Do Until rs1.EOF = True
                strKey = rs1.Fields(0).Value
                If oMT.LoadFromDB(strKey) = True Then
                    oMT.ValidFlag = 0
                    If oMT.SaveToDB() = True Then
                        bResult = True
                    End If
                End If
                rs1.MoveNext()
            Loop
        End If

        Return bResult
    End Function
1 回复
#2
黄某某某人2018-04-25 17:44
EffectiveDate 代表有效标志,MTVehicle是表。

[此贴子已经被作者于2018-4-25 17:48编辑过]

1