This is a migrated thread and some comments may be shown as answers.

SQL Proc Parameters in WinForm Reporting

1 Answer 15 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Levi
Top achievements
Rank 1
Levi asked on 06 Feb 2017, 10:16 PM

I looked for this and didn't find anything so I am asking it here.  I have a trdx report I built and am trying to get it to work in my application.  I have a stored proc that requires 2 parameters, agentNumb and orderBy.  I am using the uriReportSource and I cant seem to figure out how to pass it the sql parameters.  The only way I can get it to work is to add the actual values to the trdx file in code view. Online I have found this, but still cant get it to work:

        Dim uriReportSource As New Telerik.Reporting.UriReportSource()
        ReportViewer1.ReportSource = uriReportSource
        ' Specifying an URL or a file path
        uriReportSource.Uri = "Reports\AgentInvestorsList.trdx"

        ' Adding the initial parameter values
        uriReportSource.Parameters.Add(New Telerik.Reporting.Parameter("@AGENT_NUMB", agentNumb))
        uriReportSource.Parameters.Add(New Telerik.Reporting.Parameter("@ORDER_BY", orderBy))

Any help would be greatly appreciated.

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 09 Feb 2017, 11:53 AM
Hello Levi,

Before proceeding with UriReportSource parameters, my recommendation is to configure the report to use a data source component and a parameterized data retrieval method. 

For example, you can use parameterized SQL queries and map the SQL parameters to report parameters. Where report parameters values can be passed though the viewer - How To: Pass values to report parameters.

Additionally, the viewer's reportSource.Parameters collection is mapped by key to the report's ReportParameters collection. Most probably the report parameters names don't have @ prefix.

Details how to configure a data source component to use parameterized queries are available in the SqlDataSource Wizard help article.

I hope the above information is helpful.


Regards,
Peter
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Levi
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or