0

我有以下代码用于传递参数以打开 crsytal 报告。但是当它打开水晶报告时,我再次询问参数以显示报告。

        ReportDocument cryRpt = new ReportDocument();
        TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
        TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
        ConnectionInfo crConnectionInfo = new ConnectionInfo();
        Tables CrTables;
        cryRpt.Load(Server.MapPath("DMTR1.rpt"));
        crConnectionInfo.ServerName = m_strConnectionString.Split(';')[0].Split('=')[1]; 
        crConnectionInfo.DatabaseName = m_strConnectionString.Split(';')[1].Split('=')[1]; 
        crConnectionInfo.UserID = m_strConnectionString.Split(';')[2].Split('=')[1]; 
        crConnectionInfo.Password = m_strConnectionString.Split(';')[3].Split('=')[1]; 
        CrTables = cryRpt.Database.Tables;
        foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
        {
            crtableLogoninfo = CrTable.LogOnInfo;
            crtableLogoninfo.ConnectionInfo = crConnectionInfo;
            CrTable.ApplyLogOnInfo(crtableLogoninfo);
        }
        cryRpt.SetParameterValue("@ReceivedDate", Convert.ToDateTime("06/21/2013"));
        cryRpt.SetParameterValue("@TransferDate", Convert.ToDateTime("08/21/2013"));
        crysview.ReportSource = cryRpt;
        crysview.RefreshReport();
4

1 回答 1

2

您需要替换crysview.RefreshReport();crysview.DataBind();.

于 2013-07-15T11:58:24.680 回答