protected void BindLocalReport(MsLocalReport localReport, IReport report) { ILocalReportProcessingLocation location = (ILocalReportProcessingLocation)report.ReportProcessingLocation; localReport.LoadReportDefinition(ReportDefinitionCache.GetReportDefinition(location.File).GetReportStream()); localReport.EnableHyperlinks = true; localReport.EnableExternalImages = true; localReport.SetBasePermissionsForSandboxAppDomain(new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted)); //localReport.ExecuteReportInCurrentAppDomain(AppDomain.CurrentDomain.Evidence); //localReport.AddFullTrustModuleInSandboxAppDomain(new System.Security.Policy.StrongName(new System.Security.Permissions.StrongNamePublicKeyBlob(Nullable),"VB.Reports.App.ReportStyleLibrary.StyleSheet","1.0.0")); //localReport.AddTrustedCodeModuleInCurrentAppDomain(System.Reflection.Assembly.GetAssembly(typeof(VB.Reports.App.ReportStyleLibrary.StyleSheet)).ToString()); if (localReport.IsDrillthroughReport) { localReport.SetParameters(localReport.OriginalParametersToDrillthrough); } else { IList <MsReportParameter> parameters = new List <MsReportParameter>(); foreach (IReportParameter parameter in report.ReportParameters) { parameters.Add(new MsReportParameter(parameter.Name, GetParameterValue(parameter))); } localReport.SetParameters(parameters); } localReport.DataSources.Clear(); foreach (IReportDataCommandTemplate reportDataCommandTemplate in report.ReportDataCommandTemplates) { DictionaryDataParameterValue parameterValues = new DictionaryDataParameterValue(); foreach (IReportParameter parameter in reportDataCommandTemplate.Parameters) { if (localReport.IsDrillthroughReport) { parameterValues[parameter.Name] = GetParameterValue(parameter, localReport.OriginalParametersToDrillthrough); } else { parameterValues[parameter.Name] = GetParameterValue(parameter); } } using (IDataConnection connection = SimpleQuery.ConfigurationManagerConnection(location.DataSourceName)) { if (connection.State == ConnectionState.Closed) { connection.Open(); } using (IDataCommand command = connection.CreateCommand(reportDataCommandTemplate, parameterValues.DataParameterValue)) { command.CommandTimeout = 200; using (IDataReader reader = command.ExecuteReader()) { DataTable table = DataTableMapper.ToDataTable(reader); localReport.DataSources.Add(new MsReportDataSource(reportDataCommandTemplate.Name, table)); } } } } localReport.Refresh(); }