SQL Server Reporting Services url parameters not working

天大地大妈咪最大 提交于 2020-01-01 16:50:12

问题


I cannot correctly pass the parameters to a SQL Server Reporting server. The report page is displayed, but the Report Viewer Web Part’s parameter prompts are still empty and nothing is run.

The following url takes me to the correct report page, where I can manually select the parameters, then click the "View Report" button and get a report.
http://MyServer/ReportServer?%2fProjects%2fProject_Report

The following are in the report webpage source:

<label for="ctl32_ctl04_ctl03_ddValue"><span>Country</span></label>

and

<option selected="selected" value="0">&lt;Select&nbsp;a&nbsp;Value&gt;</option>
<option value="1">Country01Name</option>
<option value="2">Country02Name</option>
<option value="3">Country03NameFirst&nbsp;Country03NameLast</option>
<option value="4">Country04Name</option>
<option value="5">Country05NameFirst&nbsp;Country05NameLast</option>

However, neither of the following work:

  • using the parameter label:

    http://MyServer/ReportServer?%2fProjects%2fProject_Report&rs:Command=Render&rp:Country=Country01Name
    
  • using the parameter name directly:

    http://MyServer/ReportServer?%2fProjects%2fProject_Report&rs:Command=Render&rp:ctl32_ctl04_ctl03_ddValue=Country01Name
    

What am I doing wrong?

The following sources did not help me

  • MSDN URL Access Parameter Reference

  • MSDN Pass a Report Parameter Within a URL

  • SO Passing parameter via url to SQL Server Reporting Services

  • SO SSRS Pass Parameter via URL


回答1:


Figured it out. I was not naming the parameters correctly, as the correct name is not listed on the Report Viewer, the webpage source or elements.

The process I completed to find the correct parameter names and generate a working url, was:

  1. set the parameters on the Report Viewer manually,
  2. generate the report - which adds a menu bar to the Report Viewer frame,
  3. click on the "Export to Data Feed" button on the new menu bar,
  4. download the *.atomsvc file,
  5. open the *.atomsvc in a text editor,
  6. copy the href= url into another file,
  7. replace all &amp; with & and %3A with :in the url,
  8. change Format=ATOM to Format=HTML4.0 to render the report in the browser,
    • other formats can be set in the url
  9. (Optional) delete the parameters that I do not need set
  10. (Optional) add &rc:Parameters=Collapsed to the end of the url to collapse the parameter menu.

This gave me a working url that generated the report automatically and displayed in browser or started to download a file in the format set by the Format= parameter.



来源:https://stackoverflow.com/questions/39187372/sql-server-reporting-services-url-parameters-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!