以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  计算日期的代码表达式如何写?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=136315)

--  作者:malavazos
--  发布时间:2019/6/11 11:21:00
--  计算日期的代码表达式如何写?
执行下述代码报错,应该是d2的表达式错误,请老师帮忙?
Dim dr As DataRow
Dim d1 As Date = Date.Today
Dim d2 As Integer =  DataTables("检定流水记录").Find("[本年计划检定日期]")- d1 > 0
dr = DataTables("检定流水记录").Find("[本年计划检定日期]")
If dr IsNot Nothing Then
    Dim wz As Integer = Tables("检定流水记录").FindRow(dr)
    If wz >= 0 Then
        Tables("检定流水记录").Position = wz
    End If
End If
MainTable = Tables("检定流水记录")

--  作者:有点甜
--  发布时间:2019/6/11 11:54:00
--  

比如

 

Dim fdr As DataRow = DataTables("检定流水记录").Find("[本年计划检定日期] > #" & d1 & "#")

 

http://www.foxtable.com/webhelp/scr/1284.htm

 

http://www.foxtable.com/webhelp/scr/2919.htm

 

 


--  作者:malavazos
--  发布时间:2019/6/11 12:05:00
--  
修改后,代码执行结果WZ始终是 -1

Dim dr As DataRow
Dim d1 As Date = Date.Today
Dim fdr As DataRow = DataTables("检定流水记录").Find("[本年计划检定日期] > #" & d1 & "#")
If fdr IsNot Nothing Then
    Dim wz As Integer = Tables("检定流水记录").FindRow(dr)
    If wz >= 0 Then
        Tables("检定流水记录").Position = wz
    End If
output.show(wz)
End If
MainTable = Tables("检定流水记录")


--  作者:有点甜
--  发布时间:2019/6/11 12:26:00
--  

 

Dim wz As Integer = Tables("检定流水记录").FindRow(fdr)