CrystalReportViewer显示空白报告

时间:2015-04-09 15:56:02

标签: c# asp.net crystal-reports

我正在创建一个网页,我想要一个水晶查看器,我有rpt文件,在我的网页代码中我写了内页加载事件

 report = new ReportDocument();
        //report.FileName = Server.MapPath(@"reports\Ledger.rpt");
        report.Load(Server.MapPath(@"reports\Ledger.rpt"));
        string server = WebConfigurationManager.AppSettings["ReportServer"];
        string user = WebConfigurationManager.AppSettings["ReportUserID"];
        string password = WebConfigurationManager.AppSettings["ReportUserPwd"];
        string database = WebConfigurationManager.AppSettings["ReportDatabase"];
        report.SetDatabaseLogon(user, password, server, database);
        string strSelection = "1=1 ";
        string strTitle = WebConfigurationManager.AppSettings["CompanyName"].ToString();
        string strTitle1 = WebConfigurationManager.AppSettings["AppName"].ToString();
        report.SetParameterValue("CompanyName", strTitle);
        report.SetParameterValue("AppName", strTitle1);
        report.SetParameterValue("startDate", DateTime.Now);
        report.SetParameterValue("endDate", DateTime.Now);


        CrystalReportViewer1.ReportSource = report;

在我的aspx文件中我有

<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" 
            AutoDataBind="true"   
            ReportSourceID="CrystalReportSource1" />
            <CR:CrystalReportSource ID="CrystalReportSource1" runat="server" >
                                <Report FileName="reports\Ledger.rpt">
                                </Report>
                            </CR:CrystalReportSource> 

无论我做什么它只显示空白报告,我该怎么做? 请帮忙

1 个答案:

答案 0 :(得分:0)

在Crystal Report Viewer中,您有Visible =&#34; false&#34;,您可以将其更改为true吗?