水晶报表
来源:互联网 发布:php 变量前加@ 编辑:程序博客网 时间:2024/05/18 02:49
关于水晶报表出现登录窗口问题的解决方法
在IIS上部署水晶报表时,经常会出现水晶报表页码的工具栏图片显示不出来,或者页码弹出windows登录提示窗口。
问题的症结:是水晶报表图片无访问权限
终极解决方案:在系统部署所在IIS网站的目录下,找到aspnet_client目录,在属性窗口“目录安全性”标签的“用户验证与访问控制”设置项中,勾选“允许匿名访问”,即可解决此问题。
特别提醒:需要注意的是,不要将everyone用户设置为完全控制,或者添加很多不必要的用户权限,去解决此问题,否则将导致操作系统的安全性存在重大隐患。
解决水晶报表出现登陆框的问题 收藏
你最好还是用sql连接,因为oledb和sql的连接信息不是一样的.
如果你用的是水晶报表的推模式,一般不用设置登陆信息,但是要这样写:obj.SetDataSource(this.ds.Tables["tablename"]);如果你写成了obj.SetDataSource(this.ds)就会有登陆框的。
如果你用的是水晶报表的拉模式,你就一定要写上登陆信息:
crReportDocument = new OracleReport();
//Set the crConnectionInfo with the current values stored in the report
crConnectionInfo = crReportDocument.Database.Tables[0].LogOnInfo.ConnectionInfo;
/* Populate the ConnectionInfo Objects Properties with the appropriate values for
the ServerName, User ID, Password and DatabaseName. However, since Oracle
works on Schemas, Crystal Reports does not recognize or store a DatabaseName.
Therefore, the DatabaseName property must be set to a BLANK string. */
crConnectionInfo.DatabaseName = "";
crConnectionInfo.ServerName = "Your Server Name";
crConnectionInfo.UserID = "Your User ID";
crConnectionInfo.Password = "Your Password";
//Set the CrDatabase Object to the Report's Database
crDatabase = crReportDocument.Database;
//Set the CrTables object to the Tables collection of the Report's dDtabase
crTables = crDatabase.Tables;
//Loop through each Table object in the Tables collection and apply the logon info
//specified ealier. Note this sample only has one table so the loop will only execute once
foreach (Table crTable in crTables)
{
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo (crTableLogOnInfo);
// if you wish to change the schema name as well, you will need to set Location property as follows:
// crTable.Location = "<new schema name>." + crTable.Name;
}
//Set the ReportSource of the CrystalReportViewer to the strongly typed Report included in the project
crystalReportViewer1.ReportSource = crReportDocument;
还有一点要注意:
如果你用到了子报表,一定要处理:
//Go through each sections in the main report and identify the subreport by name
crSections = crReportDocument.ReportDefinition.Sections;
foreach(Section crSection in crSections)
{
crReportObjects = crSection.ReportObjects;
//loop through all the report objects to find all the subreports
foreach(ReportObject crReportObject in crReportObjects)
{
if (crReportObject.Kind == ReportObjectKind.SubreportObject)
{
//you will need to typecast the reportobject to a subreport
//object once you find it
crSubreportObject = (SubreportObject)crReportObject;
//open the subreport object
crSubReportDoc = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName);
//Once the correct subreport has been located pass it the
//appropriate dataset
if(crSubReportDoc.Name == "FirstSub")
{
//crSubReportDoc.Database.Tables[0].SetDataSource(ds);
crSubReportDoc.SetDataSource(ds);
}
}
}
}
crystalReportViewer1.ReportSource = crReportDocument;
同样crSubReportDoc.SetDataSource(ds);改为:crSubReportDoc.SetDataSource(ds.Tables["tablename"]);
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/add8849/archive/2006/01/05/570844.aspx
彻底解决 CrystalReports 登录失败问题(海波.NET,更新:2003-11-07-01)
---------------------------------------------------------------
目录:
一、Crystal Reports 9 最新补丁下载(搜集:海波.NET)
二、原因1:文件夹 NTFS 权限的问题。
三、原因2:PULL 模式,水晶报表中的数据库登录问题(非 Windows 集成身份验证)。
四、原因3:PUSH 模式设置了 TableLogOnInfo,不需要!
五、出错:部署到其它计算机,产生问题:连接失败。错误的登录参数。
六、安全之道:crystalreport 的集成认证如何与NT(2K)SERVER集成?
七、原因4:PULL 模式,水晶报表中的数据库登录问题(Windows 集成身份验证)。
---------------------------------------------------------------
问题:
CrystalReports 登录失败
LogOnException
---------------------------------------------------------------
一、Crystal Reports 9 最新补丁下载
(1)Crystal Reports 9 Database and Export Drivers Monthly Hot Fix
http://support.crystaldecisions.com/communityCS/FilesAndUpdates/cr90dbexwin_en.zip.asp?recDnlReq=Record&dnlPath=cr90dbexwin_en.zip
(2)Crystal Reports 9 Developer Files Monthly Hot Fix
http://support.crystaldecisions.com/communityCS/FilesAndUpdates/cr90devwin_en.zip.asp?recDnlReq=Record&dnlPath=cr90devwin_en.zip
(3)Crystal Reports 9.0 Main Program Files Monthly Hot Fix
http://support.crystaldecisions.com/communityCS/FilesAndUpdates/cr90mainwin_en.zip.asp?recDnlReq=Record&dnlPath=cr90mainwin_en.zip
---------------------------------------------------------------
二、原因1:文件夹 NTFS 权限的问题。
1、水晶报表 Web 查看器文件夹 NTFS 权限的问题
(1)错误提示:
“/WebApplication1”应用程序中的服务器错误。
登录失败。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: CrystalDecisions.CrystalReports.Engine.LogOnException: 登录失败。
(2)相关文件夹:
VS.NET Crystal Reports: C:/Program Files/Microsoft Visual Studio .NET/Crystal Reports/Viewers
Crystal Reports 9.2: C:/Program Files/Common Files/Crystal Decisions/2.0/crystalreportviewers
2、水晶报表文件所在的文件夹,或者导出时的目标文件夹 NTFS 权限的问题
(1)错误提示:
登录失败。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: CrystalDecisions.CrystalReports.Engine.LogOnException: 登录失败。
3、设置上述文件夹的“安全”,即 NTFS 权限:
最简单的办法是给 Everyone 用户加“完全控制”权限!
(1)为当前用户,如:Administrator,,添加“写入”权限;
(2)为用户 ASPNET、SYSTEM、匿名用户(通常为 IUSR_MACHINENAME)、经过身份验证的请求用户添加“写入”权限。
---------------------------------------------------------------
三、原因2:PULL 模式,水晶报表中的数据库登录问题。
运行时登录数据库服务器的方法(PULL 模式)
在报表的cs文件中,加上数据库连接。
1、设置 ReportDocument 的 TableLogonInfo……
Dim ReportDoc As New ReportDocument()
Dim logonInfo As New TableLogonInfo
Dim table As table
ReportDoc.Load( "C:/Rpts/publish.rpt ")
For Each table IN ReportDoc.DataBase.Tables
logonInfo= table.LogonInfo
with logonInfo.connectioninfo
.serverName= "Localhost "
.Databasename= "pubs "
.UserID= "sa "
.Password= " "
End With
table.applyLogonInfo(logonInfo)
next table
Crviewer.reportsource = reportDoc
2、如果是多个相关的表作为报表的数据源,最好使用存储过程或者查询作为数据源。
3、将“数据库连接信息”存放在 web.config 配置文件,易维护。
using CrystalDecisions.Shared ; //负责解释TableLogOnInfo类
using CrystalDecisions.CrystalReports.Engine ; //负责解释ReportDocument类
private void Page_Load(object sender, System.EventArgs e)
{
TableLogOnInfo logOnInfo = new TableLogOnInfo ();
//这里必须事先申明一个ReportDocument对象 Report,同时加载数据报表
ReportDocument oRpt = new ReportDocument();
//获取.rpt文件真实路径
string path;
path=Server.MapPath ( "cr.rpt ");
oRpt.Load (path);
//从web.config中获取logOnInfo参数信息
string a,b,c,d;
//获取ServerName
a=System.Configuration.ConfigurationSettings.AppSettings [ "servername "];
//获取DatabaseName
b=System.Configuration.ConfigurationSettings.AppSettings [ "database "];
//获取UserId
c=System.Configuration.ConfigurationSettings.AppSettings [ "userid "];
//获取password
d=System.Configuration.ConfigurationSettings.AppSettings [ "pass "];
//设置logOnInfo参数
logOnInfo.ConnectionInfo.ServerName = a;
logOnInfo.ConnectionInfo.DatabaseName = b;
logOnInfo.ConnectionInfo.UserID = c;
logOnInfo.ConnectionInfo.Password = d;
oRpt.Database.Tables [0].ApplyLogOnInfo (logOnInfo);
//建立.rpt文件与CryStalReportviewer文件之间的连接
CrystalReportViewer1.ReportSource = oRpt;
DataBind();
}
---------------------------------------------------------------
四、原因3:PUSH 模式设置了 TableLogOnInfo,不需要!
因为数据源是 DataSet,不是数据库!
---------------------------------------------------------------
五、出错:部署到其它计算机,产生问题:连接失败。错误的登录参数。
在开发机(2000)上运行,一切正常;移植到生产机(2003),就报错。错误提示:连接失败。错误的登录参数。
解决方案:
部署包少了点东西:
Crystal_Database_Access2003.msm
Crystal_Database_Access2003_chs.msm
这两个合并模块包含各种连接数据源的驱动。所以少了它,就老是提示登录失败(这种提示是不是很莫名其妙?)
---------------------------------------------------------------
六、安全之道:crystalreport 的集成认证如何与NT(2K)SERVER集成??
--------------------------------------
安全三要素:
模拟,验证,授权
--------------------------------------
如果运行 ASP.NET 程序,还需要为 ASPNET 账号——运行 ASP.NET 模拟的账号,做下述设置:
1、通过 Web 访问服务器,访问者默认“模拟”的是——Internet 来宾帐号,账号名:IUSR_计算机名;
2、“IUSR_计算机名”账号要访问 SQL SERVER,必须为该帐号建立“登录”(验证也!);
3、并授予“服务器角色”和“数据库访问许可”、“数据库角色”(授权也)!
--------------------------------------
参考:
1、匿名访问 Web 所模拟的账号
账号名:IUSR_计算机名
全名:Internet 来宾帐号
描述:匿名访问 Internet 信息服务的内置帐号
2、运行 ASP.NET 模拟的账号
账号名:ASPNET
全名:aspnet_wp account
描述:运行 ASP.NET 工作进程的账号
---------------------------------------------------------------
七、原因4:PULL 模式,水晶报表中的数据库登录问题(Windows 集成身份验证)。
1、错误提示:
“/MyWebApp”应用程序中的服务器错误。
用户 'PYPC101/ASPNET ' 登录失败。
2、问题分析:
设计水晶报表时,在“数据库专家”的“连接信息”里使用了“集成安全”,即 Windows 集成身份验证。
3、解决方案:
要为 ASPNET 账号增加数据库登录和访问权限……
但这样不太适用,设计时最好使用数据库服务器的身份验证,用服务器的账号登录,比如:sa!
4、参考:三、原因2:水晶报表中的数据库登录问题。
- 水晶报表
- 水晶报表
- 水晶报表
- 水晶报表
- 水晶报表
- 水晶报表
- 水晶报表
- 水晶报表
- 水晶报表
- 水晶报表
- 水晶报表
- 水晶报表
- 水晶报表
- 水晶报表
- 水晶报表
- 水晶报表
- 水晶报表
- 水晶报表
- VS2005 与 Matalab R2007b(7.5)混合编程 总结
- WCSTOMBS 函数不支持中文件的解决方法
- 生成器模式
- POJ 3274 Gold Balanced Lineup(HASH)
- GridView控件的汇总
- 水晶报表
- 将普通jar文件打包成osgi bundle的方法总结
- 非常漂亮的jQuery桌面插件
- FreeBSD7.0+opengate+ipfw(网页网关认证)Captive Portal(1)
- FreeBSD7.0+opengate+ipfw(网页网关认证)Captive Portal(1)
- 浅谈Java多线程的同步问题【转载】
- 打印基础知识(1)
- Share Precompiled Header with multiple projects
- FreeBSD7.0+opengate+ipfw(网页网关认证)Captive Portal(2)