SSRS 2008 - Issue in .Net code integration

  • Hi Guys:-(,

    While integrating the .net code in SSRS (Vs 2008), I have been facing the below issue. The expression have been kept inside the textbox. while calling "TestString" function via expression, thats value retrieved and shown in the reports (After deploying the report in report server also).

    But when the DB connection interacting script having function is invoked, the below error is raised. We have tried to provide the access level in Report Server policy settings also. But it didn't help.

    What else needs to be configured?

    FYI:

    > Local Database/Built in Admin Login/Local Report Server used.

    > We have also placed the assembly (dll) file in the below locations.

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

    b) C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin

    Can anyone help to resolve this issue?

    Changes in Policy File:

    <CodeGroup

    class="UnionCodeGroup"

    version="1"

    PermissionSetName="FullTrust"

    Name="AEWS_ClassLibrary_Sample"

    Description="AEWS_ClassLibrary_Sample_Description">

    <IMembershipCondition

    class="UrlMembershipCondition"

    version="1"

    Url="C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin\AEWS_ClassLibrary.dll"/>

    </CodeGroup>

    Error Text

    Build complete -- 0 errors, 0 warnings

    [rsRuntimeErrorInExpression] The Value expression for the textrun ‘Textbox2.Paragraphs[0].TextRuns[0]’ contains an error: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    Preview complete -- 0 errors, 1 warnings

    VB Code in Class File:

    Imports System.Data.SqlClient

    Imports System.Security.Permissions

    Public Class Class1

    Public Shared Function TestString()

    Return "This is returned by Class Library"

    End Function

    Public Shared Function TestDBConnection()

    Dim permission As SqlClientPermission = New SqlClientPermission(PermissionState.Unrestricted)

    permission.Assert()

    Dim RetValue As String = ""

    Dim Conn As New SqlConnection("Data Source=SeverName;Initial Catalog=DBName;Integrated Security=True;")

    Dim DA As New SqlDataAdapter("SELECT CAST(GETDATE() AS VARCHAR(30))", Conn)

    Dim DT As New DataTable

    DA.SelectCommand.Connection.Open()

    DA.Fill(DT)

    DA.SelectCommand.Connection.Close()

    If IsDBNull(DT) Then

    RetValue = "Data table is null.."

    Else

    If DT.Rows.Count > 0 Then

    RetValue = DT.Rows(0).Item(0).ToString

    Else

    RetValue = "Data table has no rows.."

    End If

    End If

    Return RetValue

    End Function

    End Class

    Ramkumar . K
    Senior Developer
    ######################
    No Surrender... No Give Up....
    ######################

  • I got the solution for this guys.. 😉 😀

    Thanks

    Ram

    Ramkumar . K
    Senior Developer
    ######################
    No Surrender... No Give Up....
    ######################

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply