Reporting services 尝试使用自定义代码部署SSRS项目时出现标识符预期错误

Reporting services 尝试使用自定义代码部署SSRS项目时出现标识符预期错误,reporting-services,ssrs-2008,Reporting Services,Ssrs 2008,我有一个带有此自定义代码的项目: Public Function GetStdDev(ByVal Sum1 as Integer, ByVal Sum2 as Integer, ByVal Sum3 as Integer, ByVal Sum4 as Integer, ByVal Sum5 as Integer, ByVal W

我有一个带有此自定义代码的项目:

Public Function GetStdDev(ByVal Sum1 as Integer, ByVal Sum2 as Integer, 
                                          ByVal Sum3 as Integer, ByVal Sum4 as Integer,
                                          ByVal Sum5 as Integer, ByVal WAvg as double) as Double
   Dim aleph = 5/60
   Dim w1 = (Sum1 - WAvg)^2 
   Dim w2 = 2 * ((Sum2 - WAvg)^2)
   Dim w3 = 3 * ((Sum3 - WAvg)^2)
   Dim w4 = 4 * ((Sum4 - WAvg)^2)
   Dim w5 = 5 * ((Sum5 - WAvg)^2)
   Dim alpha = (w1 + w2 + w3 + w4 + w5) / 5
   Dim beta = sqrt(alpha * aleph)
   Return beta
End Function
报告可以很好地预览,但在部署它时,会出现以下错误:

There is an error on line 0 of custom code: [BC30203] Identifier expected.  
我不知道SSRS的问题是什么。谁能启发我


谢谢

您需要标记以下函数:

Public Shared Function GetStdDev`(ByVal Sum1 as Integer, ByVal Sum2 as Integer, 
                                          ByVal Sum3 as Integer, ByVal Sum4 as Integer,
                                          ByVal Sum5 as Integer, ByVal WAvg as double) as Double

这是编程规则1的经典案例:“我是个笨蛋”。问题是我做到了 没有在函数声明中加下划线,因为我忘了你必须在VB中这样做。为什么预览没有抱怨,我永远也不知道。更正后的代码为:

Public Shared Function GetStdDev(ByVal Sum1 as Integer, ByVal Sum2 as Integer, _ 
                                          ByVal Sum3 as Integer, ByVal Sum4 as Integer, _
                                          ByVal Sum5 as Integer, ByVal WAvg as double)     as Double
   Dim aleph as double = 5/60
   Dim w1 as double  = (Sum1 - WAvg)^2 
   Dim w2 as double = 2 * ((Sum2 - WAvg)^2)
   Dim w3 as double = 3 * ((Sum3 - WAvg)^2)
   Dim w4 as double = 4 * ((Sum4 - WAvg)^2)
   Dim w5 as double = 5 * ((Sum5 - WAvg)^2)
   Dim alpha as double = (w1 + w2 + w3 + w4 + w5) / 5
   Dim beta as double = sqrt(alpha * aleph)
   Return beta
End Function

没有,仍然存在部署问题。下划线是问题所在。奇怪的是,在报表部署到RS服务器之前,在预览中没有自定义代码的情况下,自定义代码是如何工作的。