以文本方式查看主题

-  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=173983)

--  作者:lgz518
--  发布时间:2021/12/25 15:29:00
--  代码报错
公式: < [(L+W)*2+4 ]  / 100 > * < [(W+H)*2)] / 100 > ,执行下面代码,报错
Select Case e.DataCol.Name
    Case "类别","规格"
        If e.DataRow.IsNull("类别") OrElse e.DataRow.IsNull("规格")  Then
            e.DataRow("面积") = Nothing
        Else
            Dim dr As DataRow 
             \'dr= DataTables("表B").find("类别=\'" & e.DataRow("类别") & "\'")
      
       dr= DataTables("表B").find("类别=\'" & e.DataRow("类别") & "\'")

            If dr IsNot Nothing Then
                Dim str As String = dr("公式")
                str = str.Replace("附加数1",dr("附加数1")).Replace("附加数2",dr("附加数2"))
                Dim ar() As String = e.DataRow("规格").split("*")
                Dim pattern As String = "[^\\d+.]"
                ar(0) = System.Text.RegularExpressions.Regex.Replace(ar(0), pattern ,"")
                str = str.Replace("L",ar(0))
                If ar.Length > 1 Then
                    ar(1) = System.Text.RegularExpressions.Regex.Replace(ar(1), pattern ,"")
                    str = str.Replace("W",ar(1))
                End If

        If ar.Length > 2 Then
                    ar(2) = System.Text.RegularExpressions.Regex.Replace(ar(2), pattern ,"")
                    str = str.Replace("H",ar(2))
                End If
        \'
                e.DataRow("S") = eval(StrToNarrow(str))


            End If
        End If
End Select





问题一:应用上面公式和代码报错如下,如何解决?
问题二:上面代码是否有调用到“自定函数”呢?印象在没升时是有“自定函数”栏设定“自定函数”,现在升级,看不到,有如何查看“自定函数”?


.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2021.12.16.888
错误所在事件:Eval函数计算错误,表达式为: < [(30.52+20.52)*2+4 ]  / 100 > * < [(20.52+10.5)*2)] / 100 > 
详细错误信息:
语法错误




--  作者:有点蓝
--  发布时间:2021/12/25 15:38:00
--  
1、括号不成对
2、全部改为普通括号,去掉中括号尖括号