Foxtable(狐表)用户栏目专家坐堂 → 编号问题


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

主题:编号问题

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


加好友 发短信
等级:四尾狐 帖子:953 积分:7252 威望:0 精华:0 注册:2011/9/6 13:36:00
  发帖心情 Post By:2016/6/28 13:04:00 [显示全部帖子]


If e.DataCol.Name = "订舱日期" Then
    If e.DataRow.IsNull("订舱日期") Then
        e.DataRow("订舱编号") = Nothing
    Else
        Dim bh As String = Format(e.DataRow("订舱日期"),"yyyyMMdd") '取得订舱编号的8位前缀
        If e.DataRow("订舱编号").StartsWith(bh) = False '如果订舱编号的前8位不符
            Dim  max As String
            Dim  idx As  Integer
            max = e.DataTable.Compute("Max(订舱编号)","订舱日期 = #" & e.DataRow("订舱日期") & "# And [_Identify] <> " & e.DataRow("_Identify")) '取得该天的最大订舱编号
            If  max > "" Then '如果存在最大订舱编号
                idx = CInt(max.Substring(12)) + 1  '获得最大订舱编号的后三位顺订舱编号,并加1
            Else
                idx = 1 '否则顺订舱编号等于1
            End  If
            e.DataRow("订舱编号") = bh & "-内贸" & Format(idx,"000")
         End If
    End  If
 End  If
这个代码出错在哪里,才会形成所有的编号变成一样了。

 回到顶部