我之前已经把水晶报表需要的数据集dataset保存到session中,
显示报表的时候,直接设置rpt.DataSource = ds.Tables
但是显示 登陆失败 的提示  ???这里应该不要连接数据库了吧?

解决方案 »

  1.   

    rpt.DataSource = ds.Tables[0]
      

  2.   

    ?????????   help me !!!
      

  3.   

    public static void LoadCrytReptView(ref DataSet DSet, string repDocumentPath, RepDocumentEnum mRepDocumentEnum, ref CrystalDecisions.Web.CrystalReportViewer CryRepView)
        {
            //*****报表处理连接
            ConnectionInfo connectionInfo = new ConnectionInfo();
            connectionInfo.ServerName = ReadWebConfigNode("ServerName");
            connectionInfo.DatabaseName = ReadWebConfigNode("DataBaseName");
            connectionInfo.UserID = ReadWebConfigNode("UserID");
            connectionInfo.Password = ReadWebConfigNode("Password");        //****构造一个报表文档
            ReportDocument oRep = new ReportDocument();        switch (mRepDocumentEnum)
            {
                //*****加载系统用户报表
                case RepDocumentEnum.SystemUserRetDocument:
                    oRep.Load(repDocumentPath);
                    oRep.SetDataSource(DSet.Tables[0]);
                    break;
                //*****加载部门报表
                case RepDocumentEnum.DeptNameRetDocument:
                    oRep.Load(repDocumentPath);
                    oRep.SetDataSource(DSet.Tables[0]);
                    break;
                //****加载在线订单报表
                case RepDocumentEnum.OnLinOrderRetDocumnet:
                    oRep.Load(repDocumentPath);
                    oRep.SetDataSource(DSet.Tables[0]);
                    break;
                //****其它报表
                case RepDocumentEnum.OtherRepDocument:
                    oRep.Load(repDocumentPath);
                    oRep.SetDataSource(DSet.Tables[0]);
                    break;
            }        CryRepView.ReportSource = oRep;
            SetDBLogonForRetot(ref connectionInfo, ref oRep);
        }