VB.NET 错误:“尚未指定报表定义的来源。” 报表查看器参数设置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18212097/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 14:38:22  来源:igfitidea点击:

VB.NET Error : "The source of the report definition has not been specified." on Report Viewer Parameter Setting

vb.netreporting-servicesreportviewer

提问by Jacob Siemaszko

By VS2012 i connect to the reporting webservice and need to load the "handShake" Parameter into my report which is a ServerReport, not a LocalReport.

通过 VS2012,我连接到报告 Web 服务,需要将“handShake”参数加载到我的报告中,它是一个 ServerReport,而不是一个 LocalReport。

This is my Page_Init Code :

这是我的 Page_Init 代码:

    If (Request.QueryString("handShake") = Nothing) Then
        Response.Redirect("~/AccessDenial.aspx")
    End If

    '' Set up the credentials
    ReportViewer1.ServerReport.ReportServerUrl = New Uri(ConfigurationManager.AppSettings("MyReportServerPath"))
    ReportViewer1.ServerReport.ReportServerCredentials = New MyReportServerCredentials()

    Dim objparameter As Microsoft.Reporting.WebForms.ReportParameter

    objparameter = New Microsoft.Reporting.WebForms.ReportParameter("handShake", Request.QueryString("handShake").ToString)

    ReportViewer1.ServerReport.SetParameters(objparameter)

The last line of code gives me the Error :

最后一行代码给了我错误:

         The source of the report definition has not been specified." 

On lots of Forums they say I need to change serverReport to localReport but this is not the case...

在很多论坛上,他们说我需要将 serverReport 更改为 localReport 但事实并非如此...

Lots of Thanks for help!

非常感谢您的帮助!

回答by Yuriy Galanter

In addition to

此外

.ServerReport.ReportServerUrl

and

.ServerReport.ReportServerCredentials

you also have to specify

你还必须指定

.ServerReport.ReportPath

that points to actual report in SSRS. This is report definition (ordinary an uploaded RDL) that you set the parameters for. E.g.

指向 SSRS 中的实际报告。这是您为其设置参数的报告定义(通常是上传的 RDL)。例如

ReportViewer1.ServerReport.ReportPath = "/My Reports/Summary Report"