以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  代码问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=52451)

--  作者:gslxgl
--  发布时间:2014/6/16 15:16:00
--  代码问题

Select e.DataCol.Name
    Case "家庭住址"
        If e.DataRow.IsNull("家庭住址") Then
            e.DataRow("编号") = Nothing
        Else
            Dim lb As String = e.DataRow("家庭住址")
            If e.DataRow("编号").StartsWith(lb) = False \'如果单据编号前缀不符
                Dim max As String
                Dim idx As Integer
                max = e.DataTable.Compute("Max(编号)","家庭住址 = \'" & lb & "\' And [_Identify] <> " & e.DataRow("_Identify")) \'取得该类别的最大编号
                If max > "" Then \'如果存在最大编号
                    idx = CInt(max.Substring(4,5)) + 1 \'获得最大编号的后三位顺序号,并加1
                Else
                    idx = 1 \'否则顺序号等于1
                End If
                e.DataRow("编号") = lb & Format(idx,"00000")
            End If
        End If
End Select

 

 

执行上面代时出现示找到integer的公共成员startswith是什么原因,编号列的设置的是整数型


--  作者:Bin
--  发布时间:2014/6/16 15:18:00
--  
说明你编号列不是字符串列,而是数值列.   请改为字符串列.