crystal Report的Logon Fail问题
我在web form里面嵌入的crystalReportViewer,页面调用的时候,报错说登录错误。
错误如下Logon failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[LogOnException: Logon failed.]
.F(String , EngineExceptionErrorID
) +506
.A(Int16 , Int32 ) +537
CrystalDecisions.CrystalReports.Engine.FormatEngine.GetPage(PageRequestContext reqContext) +539
CrystalDecisions.ReportSource.LocalReportSourceBase.GetPage(PageRequestContext pageReqContext) +189
CrystalDecisions.Web.ReportAgent.u(Boolean N) +164
CrystalDecisions.Web.CrystalReportViewer.OnPreRender(EventArgs e) +108
System.Web.UI.Control.PreRenderRecursiveInternal() +62
System.Web.UI.Control.PreRenderRecursiveInternal() +125
System.Web.UI.Control.PreRenderRecursiveInternal() +125
System.Web.UI.Page.ProcessRequestMain() +1489
我查了ms说cr在sql2k下有这样的logon fail的bug,但是,根据她的方法修改,还是
没有效果,一样的logon fail.
我的代码如下
public class test4 : System.Web.UI.Page
{
protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
//Crystal Report Variables
SalesStatistics crReportDocument=new SalesStatistics();
//'CrystalReport1' must be the name the CrystalReport
TableLogOnInfo crTableLogOnInfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
//Crystal Report Properties
CrystalDecisions.CrystalReports.Engine.Database crDatabase;
CrystalDecisions.CrystalReports.Engine.Tables crTables;
CrystalDecisions.CrystalReports.Engine.Table crTable;
private void Page_Load(object sender, System.EventArgs e)
{
crConnectionInfo.ServerName = "(local)";
crConnectionInfo.DatabaseName = "databasename
crConnectionInfo.UserID = "userid
crConnectionInfo.Password = "password
crDatabase = crReportDocument.Database;
crTables = crDatabase.Tables;
foreach(CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
{
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
}
CrystalReportViewer1.ReportSource = crReportDocument;
}