The SsrsExtender.Cache class is used within a SQL Server Reporting Services report to place field values in a Page Header or Page Footer section. An alternate method of accomplishing this, without using an external .NET assembly, can be found here.

The following code can be added to each report in the Report Properties dialog > Code tab.

{copytext|SsrsSource}

Private Shared _dict As System.Collections.Generic.Dictionary(Of String, String)
'--------------------------------------------------------------------------------------------------
Public Shared Function CacheSet(ByVal name As String, ByVal value As String) As Boolean
Dim result As Boolean = False
Try
name = name.ToUpper()
If value IsNot Nothing Then
CreateDictionary()
If _dict.ContainsKey(name) Then
_dict.Item(name) = value
result = True
Else
_dict.Add(name, value)
result = True
End If
End If
Catch ex As Exception
' ignore exceptions
End Try
Return result
End Function
'--------------------------------------------------------------------------------------------------
Public Shared Function CacheGet(ByVal name As String) As String
Dim result As String = ""
Try
name = name.ToUpper()
CreateDictionary()
If _dict.ContainsKey(name) Then
result = _dict.Item(name)
End If
Catch ex As Exception
' ignore exceptions
End Try
Return result
End Function
'--------------------------------------------------------------------------------------------------
Private Shared Sub CreateDictionary()
If _dict Is Nothing Then
_dict = New System.Collections.Generic.Dictionary(Of String, String)
End If
End Sub

Imports System.Data.SqlClient
Imports System.Security.Permissions
Public Class Cache
Private Shared _dict As Dictionary(Of String, String)
'==============================================================================================
Shared Sub New()
Dim p As SqlClientPermission = New SqlClientPermission(PermissionState.Unrestricted)
p.Assert()
_dict = New Dictionary(Of String, String)
End Sub
'==============================================================================================
Public Shared Function [Set](ByVal name As String, ByVal value As String) As Boolean
Dim p As SqlClientPermission = New SqlClientPermission(PermissionState.Unrestricted)
p.Assert()
Dim result As Boolean = False
name = name.ToUpper()
Try
If value IsNot Nothing Then
If _dict.ContainsKey(name) Then
_dict.Item(name) = value
result = True
Else
_dict.Add(name, value)
End If
End If
Catch ex As Exception
'ignore exceptions
End Try
Return result
End Function
'==============================================================================================
Public Shared Function [Get](ByVal name As String) As String
Dim p As SqlClientPermission = New SqlClientPermission(PermissionState.Unrestricted)
p.Assert()
Dim result As String = ""
name = name.ToUpper()
Try
If _dict.ContainsKey(name) Then
result = _dict.Item(name)
End If
Catch ex As Exception
'ignore exceptions
End Try
Return result
End Function
End Class