以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  记录次数问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=118356)

--  作者:zoyong
--  发布时间:2018/4/30 16:31:00
--  记录次数问题
.NET Framework 版本:2.0.50727.8745
Foxtable 版本:2018.3.9.1
错误所在事件:表,人工费明细表,DataColChanged
详细错误信息:
调用的目标发生了异常。
未找到类型“Integer”的公共成员“StartsWith”。



原代码

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  Then     \'如果单据编号前缀不符
                Dim max As String
                Dim idx As String
                max = e.DataTable.sqlCompute("Max(次数)","账户名称 = \'" & lb & "\' And [_Identify] <> " & e.DataRow("_Identify")) \'取得该账户名称的最大编号
                If max > "" Then \'如果存在最大编号
                    idx = cint(max) + 1   \'获得最大编号的后三位顺序号,并加1
                Else
                    idx = 1 \'否则顺序号等于1
                End If
                e.DataRow("次数") =  Format(idx,"00")
            End If
        End If
End Select

--  作者:有点甜
--  发布时间:2018/4/30 16:45:00
--  

Select e.DataCol.Name
    Case "账户名称"
        If e.DataRow.IsNull("账户名称") Then
            e.DataRow("次数") = Nothing
        Else
            Dim lb As String = e.DataRow("账户名称")
           
            Dim max As String
            Dim idx As String
            max = e.DataTable.sqlCompute("Max(次数)","账户名称 = \'" & lb & "\' And [_Identify] <> " & e.DataRow("_Identify")) \'取得该账户名称的最大编号
            If max > "" Then \'如果存在最大编号
                idx = cint(max) + 1   \'获得最大编号的后三位顺序号,并加1
            Else
                idx = 1 \'否则顺序号等于1
            End If
            e.DataRow("次数") =  Format(idx,"00")
        End If
End Select


--  作者:zoyong
--  发布时间:2018/4/30 16:59:00
--  
甜老师,下面代码有效,谢谢

Select e.DataCol.Name
    Case "账户名称"
        If e.DataRow.IsNull("账户名称") Then
            e.DataRow("次数") = Nothing
        Else
            Dim lb As String = e.DataRow("账户名称")
            
            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) + 1   \'获得最大编号的后三位顺序号,并加1
            Else
                idx = 1 \'否则顺序号等于1
            End If
            e.DataRow("次数") =  Format(idx,"00")
        End If
End Select