以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  指定字符长度搜索  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=120932)

--  作者:lxhmax
--  发布时间:2018/6/26 15:40:00
--  指定字符长度搜索
Dim max As String
Dim idx As Integer
max = DataTables("wtxyd").sqlCompute("max(wtdh)", "wtrq >= \'" & jt1 & "\' and wtrq < \'" & jt2 & "\' and khlx = \'海吉星自主送检\'")
---请问在这个基础上怎么添加一个条件,使得搜查的结果只是在wtdh字段中只是12个字符的,不搜查其他字符长度的结果
If max > "" Then \'如果存在最大编号
    idx = CInt(max.Substring(9,3)) + 1 \'获得最大编号的后三位顺序号,并加1
Else
    idx = 1 \'否则顺序号等于1
End If

--  作者:有点甜
--  发布时间:2018/6/26 16:43:00
--  
max = DataTables("wtxyd").sqlCompute("max(wtdh)", "len(wtdh) = 12 and wtrq >= \'" & jt1 & "\' and wtrq < \'" & jt2 & "\' and khlx = \'海吉星自主送检\'")