Solved

ReportViewer arguments

Posted on 2010-09-22
2
336 Views
Last Modified: 2013-12-16
I have a ReportViewer on a page, but I need to be able to set variables such as StartDate and EndDate inside the query for the report, but can seem to find any examples of how to set a query in code.

The field names will remain the same, so hopefully I dont need to re-design the report, all I really need to do is something like ReportViewer1.query = "select * from myTable where startDate < = 22/09/2010"

Any suggestions or examples would be great if anyones done anything like this before?

Thank you in advance!

Tony Cross
0
Comment
Question by:tonelm54
2 Comments
 
LVL 7

Expert Comment

by:DanSo1
Comment Utility
I think it's good time for you, to choose some leading solution for reporting.
I was using many of different reporting tools but for me the best so far is FastReport.
If you can't switch, please send us more code - then somebody will help you quicker.

Regards
  Daniel

0
 
LVL 15

Accepted Solution

by:
aibusinesssolutions earned 500 total points
Comment Utility
If you are setting the datasource in a ASP.NET web page, then just use a SelectParameter.  In the example below, I'm using a QueryStringParameter.  
<rsweb:ReportViewer ID="ReportViewer1" runat="server" ExportContentDisposition="AlwaysInline">

            <LocalReport EnableExternalImages="True" ReportPath="Design.rdlc">

                <DataSources>

                    <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1_tblContracts" />

                </DataSources>

            </LocalReport>

        </rsweb:ReportViewer>

        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}"

            SelectMethod="GetData" TypeName="DataSet1TableAdapters.tblContractsTableAdapter">

            <SelectParameters>

                <asp:QueryStringParameter Name="contactID" QueryStringField="id" Type="Int32" />

            </SelectParameters>

        </asp:ObjectDataSource> 

Open in new window

0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now