Foxtable(狐表)用户栏目专家坐堂 → [求助]


  共有2082人关注过本帖树形打印复制链接

主题:[求助]

帅哥哟,离线,有人找我吗?
zhbo_1025
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:8 积分:162 威望:0 精华:0 注册:2014/9/3 20:01:00
[求助]  发帖心情 Post By:2016/3/2 10:18:00 [只看该作者]

我有一段代码能在狐表以前的版本能运行,最近新的版本有一行代码不能运不知道怎么回事?

 max = e.DataTable.Compute("Max(派车单号)","出车时间 >= #" & fd & "# And 出车时间 <= #" & ld & "# And [_Identify] <> " & e.DataRow("_Identify")) '取得该月的最大
以下是全部代码

 

If e.DataCol.Name = "出车时间" Then
    If e.DataRow.IsNull("出车时间") Then
        e.DataRow("派车单号") = Nothing
        e.DataRow("星期") = Nothing
        e.DataRow("月份") = Nothing
        e.DataRow("年份") = Nothing
    Else
        Dim d As Date = e.DataRow("出车时间")
        Dim y As Integer = d.Year
        Dim fd As Date = New Date(y,1,1) '获得该月的第一天
        Dim ld As Date = New Date(y,12,31) '获得该月的最后一天
        Dim bh As String = Format(d,"yyyy") & "年岳检车派字第"  '生成编号的前4位,4位年
       
        If e.DataRow("派车单号").StartsWith(bh) = False '如果编号的前6位不符
            Dim max As String
            Dim idx As Integer
           max = e.DataTable.Compute("Max(派车单号)","出车时间 >= #" & fd & "# And 出车时间 <= #" & ld & "# And [_Identify] <> " & e.DataRow("_Identify")) '取得该月的最大
            If max > "" Then '如果存在最大编号
                idx = CInt(max.Substring(11,4)) + 1 '获得最大编号的后三位顺序号,并加1
            Else
                idx = 1 '否则顺序号等于1
            End If
            e.DataRow("派车单号") = bh & Format(idx,"0000") & "号"
            e.DataRow("星期") = Format(e.DataRow("出车时间"),"dddd")
            e.DataRow("年份") = Format(e.DataRow("出车时间"),"yyy")
            e.DataRow("月份") = Format(e.DataRow("出车时间"),"MMM")
        End If
    End If
End If


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/3/2 10:46:00 [只看该作者]

报什么错?

 

自行调试方法 http://www.foxtable.com/help/topics/1485.htm

 


 回到顶部