mercredi 28 mai 2014

SQL - code personnalisé s'exécute pas dans SSRS 2008 lors du rendu au format PDF - Stack Overflow


UPDATE: Ok so the custom code works in SSRS 2008 report services but not when I render the report as PDF. The code is trying to create a dynamic report title in the master report header.


It runs great in report services but when I save as PDF only the value from the last subreport (the last time the custom code is executed on the report) is showing on all headers...


How can I get the PDF render to correctly execute the custom code for each subreport??




Previous question details here...


I was using a Code module in my SSRS 2008 report but it was not functioning correctly after I deployed the report.


I am now trying to create a custom code assembly to do the same thing however I'm receiving the error:


> [rsErrorLoadingCodeModule] Error while loading code module: 

>> SSRSDynamicRptTitle, Version=1.0.0.0, Culture=neutral,
>> PublicKeyToken=null.
>>
>> Details: Could not load file or assembly 'SSRSDynamicRptTitle,
>> Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its
>> dependencies. The system cannot find the file
>> specified. C:\DEV\KPI\APKPIReports\APKPIReports\MasterReport2.rdl

I have copied the dll to here: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies
here
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies
and here:
C:\Program Files\Microsoft SQL Server\MSRS10.SQL2008VANILLA\Reporting Services\ReportServer\bin


but still no dice.


Here is the code from the module I am trying to turn into an assembly:


Public Class DynamicRptTitle

Public Shared myTitle As String

Public Shared Function SetRptTitle(ByRef t As String) As Boolean

myTitle = t
Return False 'not hidden

End Function

End Class

Originally I just had the shared variable myTitle and the shared function SetRptTitle in the Code portion of the project which worked perfectly in SSRS 2008R2, but not in 2008.


Any ideas?


UPDATE:


Meh, ok so I had copied the dll to the wrong folders. Apparently I needed it here:


C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies


and here:


C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies


I was copying it to the wrong version of VS...


I also changed the assembly name to the same name as the dll/namespace since the GAC said that was a good idea. Smart guy, that GAC.


Anyhow it's 'almost' working. It still works in my local dev environment but not when it's deployed. On the deployed report the last value I plug into the dll is repeated throughout the entire report. Are there any special considerations when deploying an assembly? Maybe I need to revisit GAC...



UPDATE: Ok so the custom code works in SSRS 2008 report services but not when I render the report as PDF. The code is trying to create a dynamic report title in the master report header.


It runs great in report services but when I save as PDF only the value from the last subreport (the last time the custom code is executed on the report) is showing on all headers...


How can I get the PDF render to correctly execute the custom code for each subreport??




Previous question details here...


I was using a Code module in my SSRS 2008 report but it was not functioning correctly after I deployed the report.


I am now trying to create a custom code assembly to do the same thing however I'm receiving the error:


> [rsErrorLoadingCodeModule] Error while loading code module: 

>> SSRSDynamicRptTitle, Version=1.0.0.0, Culture=neutral,
>> PublicKeyToken=null.
>>
>> Details: Could not load file or assembly 'SSRSDynamicRptTitle,
>> Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its
>> dependencies. The system cannot find the file
>> specified. C:\DEV\KPI\APKPIReports\APKPIReports\MasterReport2.rdl

I have copied the dll to here: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies
here
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies
and here:
C:\Program Files\Microsoft SQL Server\MSRS10.SQL2008VANILLA\Reporting Services\ReportServer\bin


but still no dice.


Here is the code from the module I am trying to turn into an assembly:


Public Class DynamicRptTitle

Public Shared myTitle As String

Public Shared Function SetRptTitle(ByRef t As String) As Boolean

myTitle = t
Return False 'not hidden

End Function

End Class

Originally I just had the shared variable myTitle and the shared function SetRptTitle in the Code portion of the project which worked perfectly in SSRS 2008R2, but not in 2008.


Any ideas?


UPDATE:


Meh, ok so I had copied the dll to the wrong folders. Apparently I needed it here:


C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies


and here:


C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies


I was copying it to the wrong version of VS...


I also changed the assembly name to the same name as the dll/namespace since the GAC said that was a good idea. Smart guy, that GAC.


Anyhow it's 'almost' working. It still works in my local dev environment but not when it's deployed. On the deployed report the last value I plug into the dll is repeated throughout the entire report. Are there any special considerations when deploying an assembly? Maybe I need to revisit GAC...


0 commentaires:

Enregistrer un commentaire