Reportviewer-在本地模式下提示输入参数? [英] Reportviewer - Prompt for parameters in local mode?

查看:171
本文介绍了Reportviewer-在本地模式下提示输入参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Microsoft ReportViewer控件是否可以在本地模式下提示输入参数?

我添加了一个参数来过滤报告,该参数可以是一个参数的多个值.

我已经设置了参数的可用Values属性,以从查询中读取值列表.

我希望如果我没有在代码中设置参数值,报告将像Crystal报表一样提示输入它们(我为参数可用值设置数据源)

我已经对此进行了一些研究,据我所知,该报告提示输入参数的唯一时间是该报告是否以服务器处理模式运行.

是这种情况吗?我试图避免必须在页面上添加控件以选择要传递给报告的参数.

可用的参数属性与本地报告有关吗?还是两者都存在?

为完整起见,以下是代码im用来设置报告的数据源:

            //Set the report
            Reporting.Common.SetReportEmbeddedResource( this.ReportViewer1, "Reporting.Reports.BudgetEnquiryDrilldown.rdlc" );

            //Set the datasources
            this.ReportViewer1.LocalReport.DataSources.Add(
                new ReportDataSource(
                    "BudgetEnquiry",
                     Reporting.Repositories.BudgetEnquiryDrilldown.GetBudgetEnquiryRecords(
                            base.CurrentSageDatabase,
                            base.CurrentUser.UserID ) ) );

            this.ReportViewer1.LocalReport.DataSources.Add(
                new ReportDataSource(
                    "AccountNumber",
                    Reporting.Repositories.BudgetEnquiryDrilldown.GetAccountNumbers(
                        base.CurrentSageDatabase ) ) );

            this.ReportViewer1.LocalReport.DataSources.Add(
                new ReportDataSource(
                    "CostCentre",
                    Reporting.Repositories.BudgetEnquiryDrilldown.GetCostCentres(
                        base.CurrentSageDatabase ) ) );

            //Refresh the report
            this.ReportViewer1.LocalReport.Refresh();

解决方案

我不认为您可以使用ReportViewer,但是用所需的参数创建新表单并将其传递给报表很容易./p>

看看这个:


    Dim params As New List(Of Microsoft.Reporting.WinForms.ReportParameter)
' Add Parameters of type Microsoft.Reporting.Windows.ReportParameter
    params.Add(New Microsoft.Reporting.WinForms.ReportParameter("Test", "Whatever"))

    RptViewer.LocalReport.SetParameters(params)

在这种情况下,参数测试的值为"whatever".

Is it possible for the Microsoft ReportViewer control to prompt for parameters in local mode?

I have added a parameter to filter the report by, which can be mulitple values for the one parameter.

I have set the available Values property of the paramter to read a list of Values from a query.

I was hoping if I did not set parameter values in code the report would prompt for them like crystal reports does ( Im setting the datasource for the parameter available values )

I have done some research on this and as far as I can tell the only time the report would prompt for parameters is if the report is running in server processing mode.

Is this the case? I'm trying to avoid having to add controls to the page to select parameters to pass to the report.

Are available parameter properties relevent to the Local report or are they just there for both?

for completeness, here is the code im using to set the datasource for the report:

            //Set the report
            Reporting.Common.SetReportEmbeddedResource( this.ReportViewer1, "Reporting.Reports.BudgetEnquiryDrilldown.rdlc" );

            //Set the datasources
            this.ReportViewer1.LocalReport.DataSources.Add(
                new ReportDataSource(
                    "BudgetEnquiry",
                     Reporting.Repositories.BudgetEnquiryDrilldown.GetBudgetEnquiryRecords(
                            base.CurrentSageDatabase,
                            base.CurrentUser.UserID ) ) );

            this.ReportViewer1.LocalReport.DataSources.Add(
                new ReportDataSource(
                    "AccountNumber",
                    Reporting.Repositories.BudgetEnquiryDrilldown.GetAccountNumbers(
                        base.CurrentSageDatabase ) ) );

            this.ReportViewer1.LocalReport.DataSources.Add(
                new ReportDataSource(
                    "CostCentre",
                    Reporting.Repositories.BudgetEnquiryDrilldown.GetCostCentres(
                        base.CurrentSageDatabase ) ) );

            //Refresh the report
            this.ReportViewer1.LocalReport.Refresh();

解决方案

I don't think you can using the ReportViewer per say, but it's easy to create a new form with the parameters needed and pass them to the report.

Look at this :


    Dim params As New List(Of Microsoft.Reporting.WinForms.ReportParameter)
' Add Parameters of type Microsoft.Reporting.Windows.ReportParameter
    params.Add(New Microsoft.Reporting.WinForms.ReportParameter("Test", "Whatever"))

    RptViewer.LocalReport.SetParameters(params)

In this case, the param test is given the value "whatever".

这篇关于Reportviewer-在本地模式下提示输入参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆