水晶报表,所有参数均已设置,并且仍然提示一个参数

时间:2018-07-05 03:15:51

标签: c# winforms crystal-reports crystal-reports-xi

// reportvieform的代码  public void DisplayReportHybrid(List ReportLocations,DataSet ReportDataSource,List> ParamList)

   {
        ReportDocument rd = new ReportDocument();
        ConnectionInfo crConnectionInfo = new ConnectionInfo();
        TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
        TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
        Tables CrTables;

        crConnectionInfo.ServerName = "";
        crConnectionInfo.DatabaseName = ""; //ConnectionConfig.Database;
        crConnectionInfo.UserID = ConnectionConfig.UserName;
        crConnectionInfo.Password = ConnectionConfig.Password;

        this.ReportLocations = ReportLocations;
        this.ReportDataSource = ReportDataSource;

        try
        {                         
            rd.Load(Application.StartupPath + "\\Reports\\" + this.ReportLocations[0] + ".rpt");                               
            CrTables = rd.Database.Tables;

            rd.SetDataSource(ReportDataSource.Tables[0]);
            foreach (KeyValuePair<String, Object> Param in ParamList)
            {
                rd.SetParameterValue(Param.Key, Param.Value);                 
            }

            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }
            crystalReportViewer.ReportSource = rd;
            crystalReportViewer.Refresh(); 
        }
        catch (Exception ex)
        {
            MessageBox.Show("viewer error  " + ex.Message);
        }

        if (this.DirectPrint)
        {
            rd.PrintToPrinter(1, false, 0, 0);
        }

    }

//主表单中的代码

List ls = new List(){“ Mainrep”,“ Subrep1”,“ Subrep2”};             ReportViewerForm frm =新的ReportViewerForm(“付款建议订单”);             列表>参数=新列表>()                  {                      新的KeyValuePair(“ @ caseNo”,txtbox1.text),
                     新的KeyValuePair(“ @ displaytype”,“ disp”),                      新的KeyValuePair(“ @ caseno”,txtbox1.text)
                 };

        DataSet dsPAO = new DataSet();
        try
        {
            dsPAO = myDataset;
            using (frm)
            {
                frm.DisplayReportHybrid(ls, ds, Param);
                frm.ShowDialog();
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show("error reports PAO " + ex.Message);
        }
        finally
        {
            dsPAO.Dispose();
        }

我在Crystal报表中有3个参数,我对这三个参数都进行了编码。但是一个参数仍然提示“ caseNo”参数。谢谢您的帮助

0 个答案:

没有答案