SSRS 2005 using a class
I need to use a custom class that is stored in a dll as开发者_如何学Gosebly. I have made a reference to the DLL under SSRS 2005 VS 2005 IDE under Report/Report Properties/References pointed to DLL and added under Classes:
Fpl.PowerGeneration.WindProdIndicators.Data.Measurements.MeasurementFactory and Instance: MFactory
Under Report/Report Properties/Code I have
Function DisplayName(byVal PlantId As Integer,Mth As Integer,Yr As Integer) As String
Dim m _factory as MFactory
returnm _factory.GetMonthlyInfo(PlantId,Mth,Yr).Site.DisplayName()
End Function
When I build I receive
There is an error on line 1 of custom code: [BC30205] End of statement expected.
Any help would be appreciated.
When you add the MFactory instance, SSRS should be instantiating the object for you with the name MFactory. But your code seems to try to create an instance of MFactory class...which is an instance, not a class. Try dropping the Dim line and just using MFactory directly.
Function DisplayName(byVal PlantId As Integer,Mth As Integer,Yr As Integer) As String
Return MFactory.GetMonthlyInfo(PlantId,Mth,Yr).Site.DisplayName()
End Function
Or better yet, just use =MFactory.GetMonthlyInfo(PlantId,Mth,Yr).Site.DisplayName()
directly in the expression where it's needed.
精彩评论