Click here to Skip to main content
16,017,297 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Quote:
Hey everybody I am facing this error with crystal report
VB
Server Error in '/' Application.
Invalid file name.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:
VB
 System.Runtime.InteropServices.COMException: Invalid file name.
Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:
VB
[COMException (0x800001fb): Invalid file name.]
   CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) +0
   CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) +95
   CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +270

[CrystalReportsException: Load report failed.]
   CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +333
   CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) +876
   CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename) +84
   WebPathLab.AgentList.Page_Load(Object sender, EventArgs e) +524
   System.Web.UI.Control.OnLoad(EventArgs e) +91
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

======================== I am Using Visual Studio 2010. Crystal report version is 13.0.2000 I have entered the following line in web.config
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
My crystal report is working fine when I run it by pressing F5 from visual studio 2010.
Directory Structure
Reports/Dataset/ Dataset1.xsd Reports/rpt/ CrystalReport1.rot Reports/ AgentList.aspx
Imported Namespaces
VB
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.IO

CodeBehind
VB
Dim reportpath As String = Server.MapPath("rpt/CrystalReport1.rpt")
com.CommandText = "SELECT  idAgent AS ID,AgentName,Add1 AS Address FROM PmAgentMaster"
com.Connection = conPatho
da.SelectCommand = com
dt.Rows.Clear()
If conPatho.State = ConnectionState.Closed Then conPatho.Open()
da.Fill(dt)
conPatho.Close()
Dim ds As New DataSet1()
ds.Tables(0).Merge(dt)
ShowPopUpMsg(reportpath)
Dim rptDoc As New ReportDocument()
rptDoc.Load(reportpath)
rptDoc.SetDataSource(ds)
CrystalReportViewer1.ReportSource = rptDoc


can anyone help me please

[edit]SHOUTING removed - OriginalGriff[/edit]
Posted
Updated 3-May-13 6:21am
v2
Comments
[no name] 3-May-13 12:08pm    
check Server.MapPath("rpt/CrystalReport1.rpt") to make sure that it ie returning what you want it to and if it is then check for permissions on that location.
JYOTIRMOY SAMANTA 4-May-13 8:01am    
D:\WEBDATA\pathology-software.com\webpathlab\Forms\Reports\rpt\CrystalReport1.rpt

The above path is returning by report path which is correct. In server CrystalReport1.rpt is exist there. As the location is within my site so I think my site have the rights to read from that location.
OriginalGriff 3-May-13 12:21pm    
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900