Crystal Report vs12参数提示

时间:2015-04-23 15:02:00

标签: c# asp.net crystal-reports

我设计了一个包含2个简单表格省份>区域的报告,然后添加了一个参数,其中param = Province.Name

然后使用选择专家我将参数与选择表达式的报告相关联。

当我加载报告时,参数被加载到一个包含所有省份的组合框中,当我选择一个时,加载符号apears并且在加载结束时没有任何反应,提示刚刚再次出现,就像我没有选择任何东西

ps:报告在没有参数的情况下工作,显示所有省份和百分比。

我的代码在init:

页面上是这样的
        base.OnLoad(e);
        String id = Request.QueryString["id"];
        ReportService ReportService = new ReportService(base.ContextData);
        CRYSTAL_REPORT cr = ReportService.GetCReportByID(Convert.ToDecimal(id));
        SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);

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

        cryRpt.Load(cr.FILE_NAME);

        crConnectionInfo.DatabaseName = builder.InitialCatalog;
        crConnectionInfo.UserID = builder.UserID;
        crConnectionInfo.Password = builder.Password;
        crConnectionInfo.ServerName = builder.DataSource;
        cryRpt.SetDatabaseLogon(builder.UserID, builder.Password, builder.DataSource, builder.InitialCatalog);

        CrTables = cryRpt.Database.Tables;
        foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
        {
            crtableLogoninfo = CrTable.LogOnInfo;
            crtableLogoninfo.ConnectionInfo = crConnectionInfo;
            CrTable.ApplyLogOnInfo(crtableLogoninfo);
        }

        CrystalReportViewer1.ReportSource = cryRpt;
        CrystalReportViewer1.DataBind(); 

我的aspx只包含1个控件

      <CR:CrystalReportViewer ID="CrystalReportViewer1" HasToggleParameterPanelButton="true" ReuseParameterValuesOnRefresh="true" runat="server" EnableDatabaseLogonPrompt="false" EnableParameterPrompt="true"  AutoDataBind="True" Width="100%" HasCrystalLogo="False" />

任何想法?提前谢谢

1 个答案:

答案 0 :(得分:1)

解决, 请注意,以备将来参考,不要将updatepanel与crystalreportviewer一起使用。