本帖最后由 xryyforver 于 2009-12-04 21:01:00 编辑

解决方案 »

  1.   

    在使用PUSH模式,ADO.Net作为数据源的时候,FILL了一个DataSet个水晶报表,此时代码FILL的DataSet的名称与ADO.Net中的名称不一致时。便会发生此种情况。
    http://topic.csdn.net/u/20090923/14/fc9ed126-30b8-4208-a697-4c5f58e55496.html
      

  2.   

    楼上两位说的我都百度到了。但是没有觉得我的问题。下面我把代码贴出,请大家帮忙。 protected void Page_Init(object sender, EventArgs e)
        {
            if (Session["ProgramID"] == null || !cd.Validation(Session["ProgramID"].ToString().Trim()))
                Response.Redirect("Error.htm");        ConfigureCrystalReports();
        }    private void ConfigureCrystalReports()
        {
            ReportDocument myReport;
            myReport = new ReportDocument();
            string reportPath = Server.MapPath("~/CR/CR_DFBForView.rpt");
            myReport.Load(reportPath);        
            SetDBLogonForReport(myReport);
            string selectionFormula = "{T_STHead.ProgramID}='" + Session["ProgramID"].ToString().Trim() 
                                    + "' And {T_STHead.Expert}='" + Session["Expert"].ToString().Trim() + "'";
            myReport.DataDefinition.RecordSelectionFormula = selectionFormula;
            CrystalReportViewer1.ReportSource = myReport;
        }    private void SetDBLogonForReport(ReportDocument myReportDocument)
        {
            try
            {
                ConnectionInfo myConnectionInfo = new ConnectionInfo();
                myConnectionInfo.ServerName = ConfigurationManager.AppSettings["ServerName"];
                myConnectionInfo.DatabaseName = ConfigurationManager.AppSettings["DatabaseName"];
                myConnectionInfo.UserID = ConfigurationManager.AppSettings["UserID"];
                myConnectionInfo.Password = ConfigurationManager.AppSettings["Password"];
                Tables myTables = myReportDocument.Database.Tables;
                foreach (CrystalDecisions.CrystalReports.Engine.Table myTable in myTables)
                {
                    TableLogOnInfo myTableLogonInfo = myTable.LogOnInfo;
                    myTableLogonInfo.ConnectionInfo = myConnectionInfo;
                    myTable.ApplyLogOnInfo(myTableLogonInfo);
                }
            }
            catch
            {
                bc.Alert("数据库登录信息不正确!");
                return;
            }
        }
      

  3.   

    2楼。我没有fill一个dataset啊。没用这种方法
    3楼说的问题是有道理的。但是我确实不知道哪里出错了。我明天继续顶贴
      

  4.   

    终于解决了。
    http://forums.devshed.com/net-development-87/crystal-report--logon-failed-error-code-0xt-438555.html
      

  5.   

    http://www.cnblogs.com/xryyforver/archive/2009/12/06/1618067.html