错误“该进程无法访问它正在被另一个进程使用的文件".在使用函数"ExportToStream"时发生 [英] Error "The process cannot access the file it is being used by another process" occurs while using function "ExportToStream"

查看:47
本文介绍了错误“该进程无法访问它正在被另一个进程使用的文件".在使用函数"ExportToStream"时发生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,
在将Crystal报告打印为pdf时,有时会出现以下错误:

Dear all,
I sometimes get the following error while printing crystal report to pdf:

   System.Runtime.InteropServices.COMException (0x80004005): The process cannot access the file because 
it is being used by another process. at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export
(ExportOptions pExportOptions, RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream
(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
 at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options) at 
 CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType formatType) at 
 CommonWA.CommonFunc.GetPDFMemoryStream(DCMSReportDoc _dcmsreportdoc, Boolean& _DataExist) in E:\wwwroot\ASPWA\CommonWA\CommonCom.vb:line 382


错误不会经常发生,但有时会发生,有人可以告诉我为什么会发生错误以及如何解决该问题吗?
非常感谢.
Ray


The error not occurs frequently but sometimes it will happen, can someone tell me why the error occurs and how can I solve the problem?
Thank you very much.
Ray

推荐答案

由于错误状态而发生-其他代码已打开文件但未关闭文件.
It occurs for the reason the error states - some other code has opened the file and not closed it.


克里斯蒂安,你好,
如果某个文件被其他进程使用,那么它是否是其他进程正在使用的晶状体报告文件?
原本,我使用默认的OpenReportMethod加载报告.如果我更改为"OpenReportByTempCopy",可以吗?此外,我想问一下,当我使用"OpenReportByTempCopy"时是否会生成一个临时副本rpt?如果是这样,临时副本将保存在哪里?在临时Internet文件中还是其他地方?
谢谢,
Ray
Hi Christian,
If a file is used by other process, is it the crytal report file being used by other process?
Orignally, I load the report using the default OpenReportMethod. If I change to "OpenReportByTempCopy", is that ok? Moreover, I would like to ask if a temp copy rpt will be generated when I use "OpenReportByTempCopy"? If so, where will be the temp copy will be saved? In temporary internet files or somewhere else?
Thanks,
Ray


Ray,您对此问题有任何解决方案吗?
Ray, did you get any solution to this problem?


这篇关于错误“该进程无法访问它正在被另一个进程使用的文件".在使用函数"ExportToStream"时发生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆