locked
How to pass a sql query string to sql reporting services? RRS feed

  • Question

  • Hi...
    How to pass a sql query string to sql reporting services?

    I am trying to create a report that takes dynamic search values from a aspx page and then pass the vlaues to the sql reporting server via the querystring.  Then I want the rs to run the report.  How do I create the query string in the report.  I have no idea which value the end user will be supllying?
    Friday, December 4, 2009 10:33 AM

Answers

All replies

  • How to pass a sql query string to sql reporting services?

    I am trying to create a report that takes dynamic search values from a aspx page and then pass the vlaues to the sql reporting server via the querystring.  Then I want the rs to run the report.  How do I create the query string in the report.  I have no idea which value the end user will be supllying?

    Thursday, December 3, 2009 10:47 AM
  • I have recently been doing some digging on just what you're asking about and came up with a few of articles that have helped. Have a look at

    http://msdn.microsoft.com/en-us/library/ms159825.aspx (Running a parameterized report)
    http://msdn.microsoft.com/en-us/library/ms155917.aspx (Adding parameters to your report)
    http://msdn.microsoft.com/en-us/library/aa337234.aspx (Creating Report Parameters and setting report parameter properties)

    Regards.

    Thursday, December 3, 2009 11:50 AM
  • Hi Shyam,

    You can pass values to Reporting Services through the URL as described here:

    http://msdn.microsoft.com/en-us/library/ms153586.aspx

    Then you can pass these to the underlying data source.

    Boyan Penev --- http://bp-msbi.blogspot.com
    Monday, December 7, 2009 2:19 AM
  • Hi Shyam,

    If I understand correctly, you want to pass a parameterized dynamic string to a SQL Server Reporting Services report from a custom web application, and then open a report in Report Server in a new window.

    If so, we can following these steps to solve the issue:
    1.Create a report
    2.In the report, use the query like this

    SELECT [Column...] FROM Table Where [Column] = @parametername

    This query will auto create a report parameter named parametername.
    3.Design the report layout.
    4.Deploy the report to the report server.
    5.Now, we can access the report using URL Access as Boyan suggested.
    E.g.  http://<servername>/reportserver?/<folder>/reportname&parametername=<values>
      
    6.In the custom web page, we can redirect the user to the report server using the URL above. Please provide the dynamic string in the <values> section.

    If there is anything unclear, please feel free to ask.

    Thanks,
    Jin Chen
    Jin Chen - MSFT
    Monday, December 7, 2009 9:27 AM
  • Shyam,

    You can create the report parameters in the code behind and bind those parameters and you can call the respective SSRS reports.

    something like this will work for you

    ReportParameter rParams = new ReportParameter("ParaName", "ParaValue");
    reportViewer1.ServerReport.SetParameters(new ReportParameter[] { rParams });
    Regards, KarthikShanth.
    Monday, December 7, 2009 9:40 AM