2017-10-08 35 views
0

我有一个SSRS报告。SSRS使用带选项的SP(重新编译)仍然需要永久加载嵌入在asp.net中的报告ReportViewer

当我使用SSRS浏览器页面打开报告http://localhost/reportserver时,报告正常工作并正在加载数据。数据只有4行。

但是,当我在报表查看器中嵌入报表时,加载意味着永远不会加载进度状态显示。

我已添加option(recompile)但仍然没有结果。

以下是我的SP

BEGIN 
-- SET NOCOUNT ON added to prevent extra result sets from 
-- interfering with SELECT statements. 
SET NOCOUNT ON; 

select s.Name,s.Id as STUDENT_ID,a.AttendanceStatus,a.AttendanceDate, 

    case when (select count(*) from 
    Attendance where AttendanceStatus='Present')> 
          (select count(*) from Attendance where 
    AttendanceStatus='Absent') then 'Regular' else 'Not Regular' end as IsRegular 
    from Student s 
    inner join Attendance a on s.Id=a.Student_ID 
    where [email protected]_Id 

    option(recompile) 

END

下面是我用的ReportViewer

得到报告
ReportViewer1.ServerReport.ReportServerUrl = new System.Uri("http://localhost/ReportServer"); 
     ReportViewer1.ServerReport.ReportPath = "/Report1"; 
     ReportViewer1.ProcessingMode = ProcessingMode.Remote; 


     Microsoft.Reporting.WebForms.ReportParameter[] Param = new Microsoft.Reporting.WebForms.ReportParameter[1]; 
     Param[0] = new Microsoft.Reporting.WebForms.ReportParameter("Student_Id","1"); 



     ReportViewer1.ShowParameterPrompts = false; 
     ReportViewer1.ServerReport.SetParameters(Param); 
+0

在没有其他细节(执行计划和索引信息),我会问你尝试修复参数嗅探。您可以尝试声明'@ Student_Id_loc'并为其指定'@ Student_Id'并在您的查询中使用'@ Student_Id_loc'。删除'选项(重新编译)' –

+1

您也可以查看报告服务器中的'executionlog3'表并检查哪里需要时间。你有'TimeDataRetrieval','TimeProcessing'和'TimeRendering'列将告诉你需要修复的东西。 –

+0

这些时间是为了在您的应用程序中执行ReportViewer中的报告吗?如果是的话,那么看起来报表执行得很好。可能是您的应用程序中的其他问题。 –

回答

-1

我不知道它背后的任何逻辑我的C#代码,但我遇到了同样的问题,首先在SP中声明一个新变量,然后在其中放入“@Student_Id”的值,然后在查询中使用这个新变量

希望它也适合你

+0

我已经试过它不能正常工作 – Alex