Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Calling Custom Code in Reporting Services

Posted on 2004-08-18
4
Medium Priority
?
975 Views
Last Modified: 2012-08-14
Hi,

I'm trying to call a custom function in SQL Server Reporting services. The code works fine in a VB.NET window application but when run through Reporting Services I get the following error:

"Request for the permission of type System.Data.SqlClient.SqlClientPermission, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed."

I think it is a security configuration/setting... possibly something with IIS?

Anyone have any ideas? The code is as below. Thanks.


Public Function FHNameLookUp(FNumber As String) As String

        Dim conTemp As New System.Data.SqlClient.SqlConnection("Integrated Security=SSPI;data source=local;initial catalog=Temp")
        Dim cmdTemp As New System.Data.SqlClient.SqlCommand("SELECT Name FROM Finance WHERE FinanceID = " + FNumber, conTemp)
        Dim drTemp As System.Data.SqlClient.SqlDataReader
        Dim FHName As String

        Try
            cmdTemp.Connection.Open()
            drTemp = cmdTemp.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
            drTemp.Read()
            FName = drTemp.GetString(0)
            drTemp.Close()
            conTemp.Close()
        Catch E As System.Exception
            System.Console.Write("Cannot retrieve name")
        End Try
        Return FName

End Function
0
Comment
Question by:DavidDunn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 11838815
I have seen this error message also on Windows Application: when the application started from a source that was not trusted by the .net engine... I solved the problem by starting the application from a local drive instead from the network drive, and read later that one could specify/manage trusted sources for .net applications (but no details :-(
I have not yet found it, but maybe this helps you already...
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 11838824
http://www.dotnet247.com/247reference/msgs/38/190410.aspx

reading, I would try to change the Report Service to run under a domain account...

Hope this helps
0
 

Author Comment

by:DavidDunn
ID: 11843190
Hi,

It appears that it was the security setting in the Reporting Services config file (as described) in the links above.

Also, I was calling an external assembly (SQLClient) and so I needed to assert permissions as below:

  Dim permission As New System.Data.SqlClient.SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted)
  permission.Assert()      

Thanks.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 11849569
Glad I could help, this way I found some answers myself (so I due YOU some points :-)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question