SSRS 2008- custom code for database query
Hi I wrote following custom code in ssrs 2008 but got error-"Type 'System.Data.SqlClient.sqlConnection' is not defined". Please provide me any kind of code that can solve my issue. Public Function SpecialList() As Boolean Dim strConnection As String = "Data Source=CDCRDCSQL04\EIS_DC;Initial Catalog=EdCATS" Using conn As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(strConnection) Dim cmd As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand("SELECT * FROM Class", conn) conn.Open() Dim dr As System.Data.SqlClient.SqlDataReader = cmd.ExecuteReader() If dr.HasRows Then Return True Else Return False End If End Using End Function
July 13th, 2011 8:02pm

Hi Mohfeza, Based on the custom code you supply, it seem that you want to get whether the dataset contain value or not, I do a test to you code, it is correct. But, to use System.Data.SqlClient.sqlConnection, you should add this reference into reporting services before using. So you can follow these steps: 1. On the Report menu, click Report Properties. 2. On the References tab, do the following: 3. In References, click the add (...) button and then select or browse to the assembly from the Add Reference dialog box. 4. In Classes, select System.data then System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 will show in the textbox. For security reason, you should change following two groups to FullTrust in three configure files, please follow these steps to allow executing the custom code: 1.Open these three files: 1).RSPreviewPolicy which located at C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies 2). rsmgrpolicy which located at C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportManager 3). rssrvpolicy which located at C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer 2. Change the PermissionSetName of the following 2 groups from “Execution” to “FullTrust”: <CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="Report_Expressions_Default_Permissions" Description="This code group grants default permissions for code in report expressions and Code element. "> </CodeGroup> <CodeGroup class="FirstMatchCodeGroup" version="1" PermissionSetName="FullTrust" Description="This code group grants MyComputer code Execution permission. "> <IMembershipCondition class="ZoneMembershipCondition" version="1" Zone="MyComputer" /> </CodeGroup> 3. Specify a execution account for Reporting Services using Report Services Configuration Manager. For more information, please see: Introducing Code Access Security in Reporting Services: http://technet.microsoft.com/en-us/library/ms154658(SQL.90).aspx Thanks, Challen Fu Forum Support If you have feedback for TechNet Subscriber Support, please contact us
Free Windows Admin Tool Kit Click here and download it now
July 14th, 2011 10:35am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics