Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Crystal reports Crystal报告的参数_Crystal Reports - Fatal编程技术网

Crystal reports Crystal报告的参数

Crystal reports Crystal报告的参数,crystal-reports,Crystal Reports,我在crystal report中创建了一个@Month作为参数名,只需插入到报告标题部分 当我运行报告时,它总是通过显示一个框来询问参数。我如何通过代码。我现有的代码如下 MyReport rpt = new MyReport(); var srcData = ; //here i added my LINQ statement to select the data rpt.SetDataSource(srcData); ParameterDiscreteValue pdValue = new

我在crystal report中创建了一个@Month作为参数名,只需插入到报告标题部分

当我运行报告时,它总是通过显示一个框来询问参数。我如何通过代码。我现有的代码如下

MyReport rpt = new MyReport();
var srcData = ; //here i added my LINQ statement to select the data
rpt.SetDataSource(srcData);
ParameterDiscreteValue pdValue = new ParameterDiscreteValue();
pdValue.Value = combo2.SelectedValue;
rpt.ParameterFields["@Month"].CurrentValues.Add(pdValue);
this.ReportViewer1.ReportSource = rpt;
this.ReportViewer1.RefreshReport();

我在哪里犯的错误?

如果它不起作用,则表明是打字错误或其他什么。尝试分析rpt.ParameterFields(设置断点并监视)。参数名是否正确?数据类型

我在添加参数时也遇到了麻烦。以下是我工作的一个例子:

string ponumber = Request.QueryString["ponumber"].ToString();
string receiptno = Request.QueryString["receiptno"].ToString();

    // Put Away Report

    CrystalReportSource CrystalReportSource1 = new CrystalReportSource();
    CrystalReportViewer CrystalReportViewer1 = new CrystalReportViewer();

    CrystalReportViewer1.ReportSource = CrystalReportSource1;
    CrystalReportViewer1.EnableParameterPrompt = false;
    CrystalReportSource1.Report.FileName = "Report3.rpt";
    CrystalReportSource1.EnableCaching = false;

    // This will set the values of my two parameters in the report
    CrystalReportSource1.ReportDocument.SetParameterValue(0, ponumber);
    CrystalReportSource1.ReportDocument.SetParameterValue(1, receiptno);



    TableLogOnInfo logOnInfo = new TableLogOnInfo();

    logOnInfo.ConnectionInfo.ServerName = ConfigurationManager.AppSettings["WarehouseReportServerName"];
    logOnInfo.ConnectionInfo.DatabaseName = ConfigurationManager.AppSettings["WarehouseReportDatabaseName"];
    logOnInfo.ConnectionInfo.UserID = ConfigurationManager.AppSettings["WarehouseReportUserID"];
    logOnInfo.ConnectionInfo.Password = ConfigurationManager.AppSettings["WarehouseReportPassword"];

    TableLogOnInfos infos = new TableLogOnInfos();
    infos.Add(logOnInfo);
    CrystalReportViewer1.LogOnInfo = infos;

    maindiv.Controls.Add(CrystalReportSource1);
    maindiv.Controls.Add(CrystalReportViewer1);


    CrystalReportViewer1.DataBind();

嗨,我通过删除crystalreportviewer的refereshReport()方法解决了这个问题


我从中找到:

ya我得到了正确的结果,我将其传递到组合框的选定值。combobox已选择的值作为对象返回如果不刷新-您可能正在查看保存的数据?