Groups | Blog | Home
all groups > sql server reporting services > august 2007 >

sql server reporting services : Error running report after deploying


JHPArizona
8/6/2007 6:30:04 PM
I have created a function that queries the database for a value if conditions
are met. IE the query in the function runs less than 2% of report. In preview
mode in VS.net, the report works correctly. When I use Report Manager to
upload the report, when the query runs, it places #Error in the report field.

This is the begining of the function:

Public Function SKU(rootSerial as String, _
currentSKU as Guid)as String
Dim currentSKUStr as String
currentSKUStr=currentSKU.ToString()
If rootSerial = "" Then
Else
Dim arset As Guid
Dim oConn as New System.Data.SqlClient.SqlConnection
oConn.ConnectionString = "Data Source=PPNS1;Initial
Catalog=Persyst_Development_MSCRM;Integrated Security=SSPI;"
oConn.Open()

Dim oCmd as New System.Data.SqlClient.SqlCommand
oCmd.Connection = oConn
oCmd.CommandText = "SELECT New_ProductId FROM
New_PersystSerialNumberExtensionBase WHERE (New_SerialNumber = N'4320401')"
arset = oCmd.ExecuteScalar()
currentSKUStr = arset.ToString()
oConn.Close()
End IF


There is additional code after End If, but that code is run for each data
row. I also have verified in the IDE via msgbox, that the correct value is
being returned from the query.

1. Is it possible to deploy a function that contains its own query as I have
done?
2. What could be the cause of it working in the IDE but not when deployed?

JHPArizona
8/7/2007 2:02:00 PM
Update:

I have traced the problem to:

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

How do I set security for embeded code?

[quoted text, click to view]
JHPArizona
8/8/2007 9:46:00 AM
Update 2:

I solved the problem and will post again after I have refined it. I am not
happy at this time with the solution as I have set the default permission
behavior from "Nothing" to "FullTrust". This is OK for my use as the web
server is private so I am less concerned about malicious code. However, I
would like to have it working with tighter permissions

[quoted text, click to view]
AddThis Social Bookmark Button