简体   繁体   中英

Crystal Report vs12 Parameter prompt

I´ve designed a report with 2 simples tables Province->District, then added a parameter where param=Province.Name

Then using the select expert i connected the parameter with the report for a select expression.

When i load the report the parameters get loaded into a combo box with all provinces and when i select one, a loading symbol apears and in the end of the loading nothing happens, the prompt just apears again, like i didint chose anything.

ps: the report works perfetly without parameters, all provinces and districs are displayed.

My code is like this on the page 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(); 

And my aspx is only contains 1 control

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

any ideas? thanks in advance

已解决,请注意,以备将来参考,请勿将updatepanels与crystalreportviewer一起使用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM