关于网友提出的“rundll 加载时出错 加载水晶报表时出报"无效的类别字符串"的错误---急得快疯了,神啊,救救我吧!”问题疑问,本网通过在网上对“rundll 加载时出错 加载水晶报表时出报"无效的类别字符串"的错误---急得快疯了,神啊,救救我吧!”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题:rundll 加载时出错 加载水晶报表时出报"无效的类别字符串"的错误---急得快疯了,神啊,救救我吧!描述:
错误提示:
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Runtime.InteropServices.COMException: 无效的类别字符串
源错误:
执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。
堆栈跟踪:
[COMException (0x80004005): 无效的类别字符串
]
CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) +0
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
[Exception: 加载报表失败。]
CrystalDecisions.Web.ReportAgentBase.()
CrystalDecisions.Web.ReportAgent.get_RequestContext()
CrystalDecisions.Web.ReportAgent.get_{()
CrystalDecisions.Web.ReportAgent.(Boolean i)
CrystalDecisions.Web.CrystalReportViewer.OnPreRender(EventArgs e)
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Page.ProcessRequestMain()
代码如下:
//使用强类型来加载报表,TestReport是在项目中添加的报表类
private void btnTest_Click(object sender, System.EventArgs e)
{
Report.TestReport tr = new MotorVehicle.Report.TestReport();
this.CrystalReportViewer1.ReportSource = Cache["Report"];
}
//用文件的方式来加载报表
private void Button1_Click(object sender, System.EventArgs e)
{
ReportDocument rd = new ReportDocument();
rd.Load( Server.MapPath("../Report/TestReport.rpt"));
this.CrystalReportViewer1.ReportSource = Cache["Report"];
}
结果:
以上两种方式都出现同样的错误. 该报表是空报表,没有涉及到数据库的字段问题. 请各位高人帮帮在下,感激感激再感激!!!!!
解决方案1:
rd.Load( Server.MapPath("../Report/TestReport.rpt"));
地址必须双斜杠
那为什么我做的报表在别人的机器上可以预览,而我自己的机器不能预览,我装了VS2005,是不是还需要安装其它的东东呀.
解决方案3:我也遇到这个问题了,顶一下
解决方案4:没遇到过,帮顶一把。。。
解决方案5:我觉得就是因为是空报表才出问题的。。你把报表相应的数据加进去看看。。
解决方案6: Report.TestReport tr = new MotorVehicle.Report.TestReport();
rd.Load();
rd.SetDataSource(ds); //ds指的是你DataSet
this.CrystalReportViewer1.ReportSource =rd;
Cache["Report"]?
不知道什么意思
帮顶,没用过报表
解决方案9:用推的方式做报表吧