I have a custom assembly that I want to use to access some SQL Server data. I'm pretty sure this is a security problem but don't know how to resolve it. This is my function in my assembly (commented most of it out until I get something to work).
PublicSharedFunction DataTest2()AsStringDim permission =New SqlClientPermissionAttribute(Security.Permissions.SecurityAction.Assert)permission.Assert()
'Dim ds As DataSetDim strReturnValueAsStringstrReturnValue =
"OK"'Dim sqlCN As New SqlClient.SqlConnection("server=EOPS; database=RegionAmericas; uid=sa; pwd=thebo$$")'Dim sqlCMD As New SqlClient.SqlCommand'Dim intNumRows As Integer = 0'strReturnValue = ""'sqlCMD.CommandText = "SELECT DESCRIPTION " & _' "FROM tblCountry WITH (NOLOCK) " & _' "WHERE COUNTRY='US'"
'Dim da As New SqlDataAdapter(sqlCMD)'Try' ds = New DataSet' da.Fill(ds, "Country")' intNumRows = ds.Tables(0).Rows.Count' If intNumRows > 0 Then' strReturnValue = ds.Tables(0).Rows(0).Item(0).ToString' End If'Catch ex As Exception' MsgBox(ex.Message)'End Try
DataTest2 = strReturnValue
EndFunction
Then I added this to rssrvpolicy file (both locally and on the server)
<CodeGroup
class="FirstMatchCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="MyCustomAssemblyCodeGroup"
Description="A special code group for M4 Custom Assemblies.">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin\M4Functions.dll"/>
</CodeGroup>
What else do I have to do? The report just shows #error. Thanks, Phill
try including ur assembly in ur global assembly cache.
No comments:
Post a Comment