?
Solved

Using a custom DLL in a report which uses Data.SqlClient

Posted on 2009-04-30
6
Medium Priority
?
643 Views
Last Modified: 2013-11-05
Hi,

I have a sql report which references a custom dll which i wrote. In this dll i access a database using the SqlClient data provider.  When i try to run the report i get the following error:

Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. (rsRuntimeErrorInExpression)

Can anyone guide me on how i can get this report to run?

Many Thanks
0
Comment
Question by:Cause
  • 4
  • 2
6 Comments
 
LVL 7

Expert Comment

by:Chandan_Gowda
ID: 24268605
follow the below link....
http://social.msdn.microsoft.com/Forums/en-US/clr/thread/436a125b-675a-4897-abce-624c92d7fb1c


I think you have add a security attribute for you method
0
 

Author Comment

by:Cause
ID: 24268809
Thanks for the reply Chandan Gowda.

I am very confused. The link seems to be concerned with file IO - should it work ok for SQL access? How do i add this security attribute in a vb.net application.

Many Thanks
0
 
LVL 7

Assisted Solution

by:Chandan_Gowda
Chandan_Gowda earned 200 total points
ID: 24268841
'add this attribute above your main method and try once
'I think this is a general problem dont worry about SQL or Flat File
'Try this approach once

Imports System
Namespace ConsoleApplication
        <System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name := "FullTrust")> _
    Class Program
        Private Shared Sub Main(ByVal args As String())
        End Sub
    End Class
End Namespace


0
How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

 

Author Comment

by:Cause
ID: 24269110
I added the line to my code but not luck - i still get the same error....
Imports System.Web
Imports System.Configuration
Imports System.Collections
 
<System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Public Class ValueForMonth

Open in new window

0
 

Author Comment

by:Cause
ID: 24269476

I have also tried the steps in this solution but no luck either i really don't know what to do.

http://forums.asp.net/t/1060891.aspx
0
 

Accepted Solution

by:
Cause earned 0 total points
ID: 24324782

Adding the code group worked finally for me but i had to make a slight change to the example in the link above.
Instead of
 <CodeGroup
        class="UnionCodeGroup"
        version="1"
        PermissionSetName="FullTrust"
        Name="MyCustomAssemblyCodeGroup"
        Description="A special code group for my custom assembly.">
      <IMembershipCondition
     class="UrlMembershipCondition"
     version="1"
     Url="C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin\MyCustomAssembly.dll"
      />
       </CodeGroup>

I have put

 <CodeGroup
        class="UnionCodeGroup"
        version="1"
        PermissionSetName="FullTrust"
        Name="MyCustomAssemblyCodeGroup"
        Description="A special code group for my custom assembly.">
      <IMembershipCondition
     class="UrlMembershipCondition"
     version="1"
     Url="file://C:/Program Files/Microsoft SQL Server/MSSQL/Reporting Services/ReportServer/bin/MyCustomAssembly.dll"
      />
       </CodeGroup>
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

After much searching across the internet I have found that you could not set the name of the file you were attaching to dynamic report subscriptons in Microsoft Reporting Services. I did manage to find one article showing you how your could make a s…
It is helpful to note: This is a cosmetic update and is not required, but should help your reports look better for your boss.  This issue has manifested itself in SSRS version 3.0 is where I have seen this behavior in.  And this behavior is only see…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

862 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