Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««45678»»

Centralising Reporting Services Stylesheets Expand / Collapse
Author
Message
Posted Thursday, November 12, 2009 10:43 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, November 12, 2009 11:20 AM
Points: 1, Visits: 10
Hi, Thank for this article. It was very helpful for understanding adding assemblies to reporting services.
However, I have run into a problem. Everything worked like charm, in a report, I changed background-color of to the value I got from the the assembly created..etc until I tried to connect to a database and get the value from there. And the reporting services just displays #Error

The function that's connect to database is working fine. The reason is b/c I created Windows App that calls this function actually receives value from DB by calling this function.

The problem happens only when I call this from Reporting Services report.
I'm thinking it's some kind of security issue?
I hard-coded connection string to db in the function. basically, I used the exact same code as you posted in this article. I just changed values of connection string.

I appreciate any help or any response.
Post #817982
Posted Friday, November 13, 2009 2:27 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, December 12, 2014 5:19 AM
Points: 2,528, Visits: 1,148
Hi chikako wakishima,

have you done the things I told , add the SQLClientpermission and codegroup. You have to do all of these to get the assambly running on RS.

Regards
Post #818310
Posted Thursday, February 11, 2010 8:22 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, December 8, 2014 6:44 AM
Points: 1,332, Visits: 19,320
For those of you struggling, I was excited about Adam's solution, but then I ended up going with an alternate approach found here (http://www.simple-talk.com/sql/reporting-services/reporting-services-with-style/)

mainly because it looked simpler from an "I don't know what I'm doing" standpoint.

Seems to work well also.


---------------------------------------------------------
How best to post your question
How to post performance problems
Tally Table:What it is and how it replaces a loop

"stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."
Post #864098
Posted Sunday, May 30, 2010 4:18 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, August 14, 2013 1:35 PM
Points: 116, Visits: 330
Does anyone know of a good way to avoid hard-coding the database connection string?
MyConnection = New SqlConnection("server=localhost;uid=USERNAME;pwd=PASSWORD;database=RSStyles")


It would be preferable to make use of an existing shared database connection, or have this database connection information stored in a config file, since it could well be the case that the connection string is different in dev and production.
Post #930193
Posted Wednesday, December 8, 2010 12:27 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, January 11, 2011 8:27 AM
Points: 1, Visits: 7
A blog post I just wrote about how to set up the DLL to use an external XML file:

http://thinkdevcode.blogspot.com/

It goes over all of the security settings you need to get it to work. Comment on it if you have any problems/questions.
Post #1032112
Posted Monday, April 18, 2011 11:05 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, October 14, 2014 10:51 PM
Points: 191, Visits: 566
Is anyone experiencing slow export to excel performance using this? Exporting to csv is very fast, but it can take minutes to export to excel.
Post #1095407
Posted Monday, March 26, 2012 8:20 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, January 14, 2014 4:38 AM
Points: 1, Visits: 40
Thanks a lot for tis code. I pretty much used as is, apart from one issue - This was the fact that the the database was hit too many times. for example for a matrix of substantial cells the database will be hit everytime a cell needs to be formatted.

To overcome that I used a a shared list of reportStyles that could be used between instances of the datadrivenstyle library. See below (following 2 lines are key - Private Shared reportStyles As List(Of ReportStyle) & If reportStyles Is Nothing Then):

Imports System.Data
Imports System.Data.SqlClient
Imports System.Security

Public Class DataDrivenStyleLibrary

'Declare shared item that can be shared between instances
Private Shared reportStyles As List(Of ReportStyle)

Public Shared Function dbStyle(ByVal ReportSection As String, ByVal StyleType As String) As String

Dim sStyle As String
sStyle = ""
'Check to see if reportstyles list exists already created and if it does not then create it
If reportStyles Is Nothing Then
reportStyles = New List(Of ReportStyle)

' Set up the command and connection objects
Dim MyConnection As SqlConnection
MyConnection = New SqlConnection("Data Source=IMGSERVER17; Initial Catalog=ReportServer; Integrated Security=SSPI;")
Dim cmd As New SqlCommand
cmd.Connection = MyConnection
cmd.Connection.Open()
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "pr_GetStyle"
' Read the data, and populate report style list
Dim ddlValues As SqlDataReader
ddlValues = cmd.ExecuteReader()
While ddlValues.Read
Dim rStyle = New ReportStyle()
rStyle.ReportSection = ddlValues.GetString(0)
rStyle.StyleType = ddlValues.GetString(1)
rStyle.StyleDefinition = ddlValues.GetString(2)
reportStyles.Add(rStyle)
End While
'Close any open connections
cmd.Connection.Close()
' return the selected value to the calling proceure
End If

'Loop up particular style from object
For Each rs In reportStyles
If rs.ReportSection = ReportSection And rs.StyleType = StyleType Then
sStyle = rs.StyleDefinition
Exit For
End If

Next
Return sStyle

End Function
End Class

Friend Class ReportStyle

Private sType As String
Private rSection As String
Private sDefinition As String


Public Property StyleType() As String
Get
Return sType
End Get
Set(ByVal value As String)
sType = value
End Set
End Property

Public Property ReportSection() As String
Get
Return rSection
End Get
Set(ByVal value As String)
rSection = value
End Set
End Property

Public Property StyleDefinition() As String
Get
Return sDefinition
End Get
Set(ByVal value As String)
sDefinition = value
End Set
End Property
End Class



Post #1272696
Posted Monday, March 26, 2012 8:53 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Saturday, December 6, 2014 9:55 AM
Points: 81, Visits: 908
Very nice! Thank you for suggesting this. It resolves the core weakness of the technique.

Regards,

Adam
Post #1272735
Posted Thursday, May 10, 2012 3:05 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, June 20, 2012 12:10 PM
Points: 1, Visits: 28
Hi,
I've been trying to get this to work for days but I keep getting the permissions error that you all talked about. I've added all the suggested code (modified the rssrvpolicy.config file, updated the DynamicStyleLibrary and gave it "Full Trust"). Nothing works. Still get this error:

Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Can anyone help?

Thanks,
Beth

P.S.
I am NOT a developer. I know nothing about assemblies, but have had a developer look at this with me...we're both stumped.
Post #1298212
Posted Thursday, July 5, 2012 11:45 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, June 11, 2014 12:43 PM
Points: 1, Visits: 48
Unfortunately, I am encountering the same problem...

It seems my namespace is not declared, despite setting up the Assembly Reference as instructed.
Post #1325601
« Prev Topic | Next Topic »

Add to briefcase «««45678»»

Permissions Expand / Collapse