Crystal Report登录:“您要求的报告需要更多信息。”

时间:2012-01-21 14:05:56

标签: c# asp.net login crystal-reports report

每次运行我的程序时,它都会提示我输入用户名和密码,但即使我输入了正确的用户名和密码,它也会让我保持在同一页面上。所以,我搜索并在我的表单的PageLoad方法中放置了下面可以看到的代码,但问题仍然存在并且无法解决。有替代解决方案吗?顺便说一句,我使用VS2008,我的数据库是Oracle 11g。

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

        cryRpt.Load(Server.MapPath("~/ADMIN/AdminReport.rpt"));

        crConnectionInfo.ServerName = "localhost";
        crConnectionInfo.DatabaseName = "";
        crConnectionInfo.UserID = "******;
        crConnectionInfo.Password = "******";
        crConnectionInfo.IntegratedSecurity = true;

        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.RefreshReport();
提前谢谢, 欧尼

1 个答案:

答案 0 :(得分:0)

您需要检查页面加载时的回发。您正在重置每个回发的报告,这就是您留在第1页的原因。将此添加到page_load方法:

if(!IsPostback)
{
    // Your code here
}