Greetings to all of you,
I have insert a custom code in my report designer, the example belowe show my code
FunctionGetCustomerOrderCount(ByValCustomerIDAsString)AsInteger
DimoPermAsNewSystem.Data.SqlClient.SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted)
oPerm.Assert()
DimoConnAsNewSystem.Data.SqlClient.SqlConnection
oConn.ConnectionString =
"Data Source=(local); Initial Catalog=Test; Integrated Security=True"
oConn.Open()
DimoCmdAsNewSystem.Data.SqlClient.SqlCommand
oCmd.Connection = oConn
oCmd.CommandText =
"Select count(*) From Orders Where CustomerID = @CustomerID"
oCmd.Parameters.AddWithValue(
"@CustomerID", CustomerID)
DimnRetValAsInteger=
oCmd.ExecuteScalar()
oConn.Close()
ReturnnRetVal
EndFunction
I have insert all references assembly and in the text box this code:
=Code.GetCustomerOrderCount(Parameters!CustomerID.Value)
But received the CAS SecurityTrasparent error code; I know that the custom code in report must have grant permission for connect to sql database but I don't know where declare this permission. There is any one to help me.
Thank you all for your cooperation
I have found the solution in this thread:
SSRS 2008- custom code for database query