on 03-10-2009 9:13 PM
I have been searching the forums and the web for hours and have not found a solution to a problem we are having. We upgraded our reports from VS.NET 2003 to VS.NET 2008 and started getting the below error upon our Report.Export code.
Logon failed. Details: mscorlib : Could not find file 'C:\Inetpub\wwwroot\xxx\ConsolidatedReports\Designers\xxxFringe\xxxFringeFunderDetail.xsd'. Failed to export the report. Error in File C:\WINDOWS\TEMP\temp_90ed8e07-481c-4bdb-8c50-885854a143d0 {B8EC61FE-7931-4979-AD92-432C21013D77}.rpt: Unable to connect: incorrect log on parameters.
So when I verify the XSD and set the data source location (XML File Path: C:\Inetpub\wwwroot\xxx\ConsolidatedReports\Designers\xxxFringe\xxxFringe.xsd) the report works fine. The problem is that when another developer trys to run the report on their machine and their machine has a different path for the code, the report fails. The odd thing is that some of our reports are working fine, it is only a few that basically are looking for the hard coded XSD path.
So, as far as I can tell the XSD are not needed (). I have applied SP1 for Crystal Reports. I am totally confused why this started and why the report is looking for a "hard coded" path to the XSD.
Hi,
This might be permission issue try to give rights to C\Windows\Temp folder and to the folder where your reports are placed.
Regards,
Shweta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this procedure once.
1,Add Xsd file in your apllication (if doesnt exists).
2, reset the Report datasource.
3, Select the XSD path.
4, change the entire path like " .\xxxFringe.xsd"
5, save the report.
Hope this will help you.
Thanks,
Salah.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have granted everyone, ASP.NET, System, etc... access to the Windows Temp directory and no luck.
Also, I have the XSD in my Visual Studio project and have re-added several times with no change in the results.
Salahudheen, I did not know you could use relative paths for the XSD, I will give that a try, but when we deploy to the server, it still looks for the XSD.
I am not sure why 80% of our reports work and 20% get this error. The reports are all setup the same way and so far have not found anything that is different between the reports (even the reports that work have a "hard coded" path, but for some reason do not get the above error message). The reports have not been editted since the upgrade from VS 2003 to VS 2008.
Thanks,
Adam
Also, when I do a "Verify Database" I get the below. No one on the development team actually has their source code in this path, so I am not sure it is looking in the Inetpub directory. Of course if I update the XSD path, I'm back to the error originally described.
-
Crystal Reports ActiveX Designer
-
Logon failed.
Details: mscorlib : Could not find file 'C:\Inetpub\wwwroot\xxx\xxxReports\DesignersIxxxFringe\xxxFringe.xsd'.
-
OK
-
The RunReport is called by a button click on a form. This method calls ExportFile which works until the line "Report.Export()" is hit.
Public Overrides Function RunReport(ByVal ReportID As Short) As String
Dim Utility As New Utility(Session("CNReportPath"))
Dim Report As New rptIndividualSalaryFringe
Dim db As New BudgetDB(Session("CNReportPath"))
Dim pDB As New ProgramDB(Session("CNReportPath"))
Dim dsRep, dsSub As DataSet
Dim AgencyID As Integer = Program1.AgencyID
Dim ProgramID As Integer = Program1.ProgramID
Dim FyID As Integer = FiscalYear1.SelectedValue
Dim ShowOnlyCSCFunded As Integer = IIf(chkShowCSCFunded.Checked = True, 1, 0)
Dim ContractNumber, AgencyName As String
Dim ReportEnv As String = Environment
Dim ReportDB As String = DBName
dsRep = db.GetIndividualSalaryFringe(AgencyID, ProgramID, FyID, ShowOnlyCSCFunded)
'dsRep.WriteXmlSchema(Server.MapPath("~/ConsolidatedReports/Designers/IndividualSalaryFringe/IndividualSalaryFringe.xsd"))
AgencyName = pDB.GetAgencyName(AgencyID)
With Report.Section1
CType(.ReportObjects("txtAgency"), TextObject).Text = AgencyName
CType(.ReportObjects("txtProgram"), TextObject).Text = pDB.GetProgramName(ProgramID)
CType(.ReportObjects("txtFiscalYear"), TextObject).Text = "Fiscal Year " & FiscalYear1.SelectedText
End With
ContractNumber = pDB.GetContractNumber(ProgramID)
If Not IsNothing(ContractNumber) Then
If Not ContractNumber = "" Then
With Report.Section6
.SectionFormat.EnableSuppress = False
CType(.ReportObjects("txtContractNumber"), TextObject).Text = "Contract #:" & ContractNumber
End With
End If
End If
With Report.Section5
CType(.ReportObjects("txtAgencyName"), TextObject).Text = AgencyName
End With
If dsRep.Tables(0).Rows.Count <= 0 Then
Report.secNoData.SectionFormat.EnableSuppress = False
Report.Section2.SectionFormat.EnableSuppress = True
Report.Section4.SectionFormat.EnableSuppress = True
Report.Section7.SectionFormat.EnableSuppress = True
Report.Section9.SectionFormat.EnableSuppress = True
Report.Section10.SectionFormat.EnableSuppress = True
Report.secFunderDetail.SectionFormat.EnableSuppress = True
Else
dsSub = db.GetIndividualSalaryFringeFunderDetail(ProgramID, FyID)
'dsSub.WriteXmlSchema(Server.MapPath("~/ConsolidatedReports/Designers/IndividualSalaryFringe/IndividualSalaryFringeFunderDetail.xsd"))
Report.OpenSubreport("subFunderDetail").SetDataSource(dsSub)
End If
'Ehn 41 add environment and db name
CType(Report.Section5.ReportObjects("DBName"), TextObject).Text = "DB: " + ReportDB
CType(Report.Section5.ReportObjects("Environment"), TextObject).Text = IIf(ReportEnv = "", ReportEnv, "Env: " + ReportEnv)
Report.SetDataSource(dsRep)
'You must set the ReportGroup equal to Crystal to make it work correctly
ReportGroup = ReportGroup.Crystal
'Leave this line of code
ReportFile = Utility.ExportFile(Report, ExportFilter1.ExportType, Server.MapPath("~/ReportFiles/"))
Return String.Empty
End Function
Public Function ExportFile(ByVal Report As ReportDocument, ByVal ExportType As ExportType, ByVal OutputPath As String, Optional ByVal ds As DataSet = Nothing) As String
Dim crDiskFileOpts As New DiskFileDestinationOptions
'Dim strFilePath As String
'Dim strLinkPath As String
Dim crExportOptions As New ExportOptions
Dim crExcelOptions As New ExcelFormatOptions
Dim crPDFOptions As New PdfRtfWordFormatOptions
Dim crWordOptions As New PdfRtfWordFormatOptions
Dim ReportName As String = String.Empty
Try
crExportOptions = Report.ExportOptions
Select Case ExportType
Case ExportType.Excel
ReportName = Left(Guid.NewGuid.ToString, 15) & ".xls"
With crExcelOptions
.ExcelTabHasColumnHeadings = True
.ExcelUseConstantColumnWidth = True
End With
crExportOptions.ExportFormatType = ExportFormatType.Excel
crExportOptions.FormatOptions = crExcelOptions
Case ExportType.PDF
ReportName = Left(Guid.NewGuid.ToString, 15) & ".pdf"
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat
crExportOptions.FormatOptions = crPDFOptions
Case ExportType.Word
ReportName = Left(Guid.NewGuid.ToString, 15) & ".doc"
crExportOptions.ExportFormatType = ExportFormatType.WordForWindows
crExportOptions.FormatOptions = crWordOptions
Case SamisConstants.ExportType.ExcelRaw
ReportName = Left(Guid.NewGuid.ToString, 15) & ".xls"
''If Not IsNothing(ds) Then
'' Dim oExcel As New ExcelExport.ExcelExport
'' oExcel.CreateWorkbook(OutputPath & ReportName, ds)
''End If
End Select
Select Case ExportType
Case ExportType.Excel, ExportType.PDF, ExportType.Word
crDiskFileOpts.DiskFileName = OutputPath & ReportName
With crExportOptions
.DestinationOptions = crDiskFileOpts
.ExportDestinationType = ExportDestinationType.DiskFile
End With
Report.Export() ' ERROR HAPPENS HERE!!!!!!
End Select
Return "ReportFiles/" & ReportName
Catch ex As Exception
Throw ex
End Try
End Function
I believe the line
Report.SetDataSource(dsRep)
is loading the report's main datasource. I did not write this code , so I am also checking it based upon the PDFs from Crystal to make sure it is following some best practices. All these reports worked fine in VS 2003.
Right now I am trying to set the table name in the dataset to see if that helps:
dsRep = db.GetIndividualSalaryFringe(AgencyID, ProgramID, FyID, ShowOnlyCSCFunded)
dsRep.DataSetName = "Table" ' THIS IS NEW - TESTING
dsRep.Tables(0).TableName = "Table" ' THIS IS NEW - TESTING
OK, here is how we're going to troubleshoot this. BTW., this is also discussed in this blog:
/people/ludek.uher/blog/2009/03/02/troubleshooting-issues-with-vs-net-datasets-and-crystal-reports
(but there appear to be some issues with that page today, so my explanation follows)
Add this line to your code:
myDataset.WriteXml(xmlPath, XmlWriteMode.WriteSchema)
as in:
dsSub.WriteXml(xmlPath, XmlWriteMode.WriteSchema)
Report.OpenSubreport("subFunderDetail").SetDataSource(dsSub)
dsRep.WriteXml(xmlPath, XmlWriteMode.WriteSchema)
Report.SetDataSource(dsRep)
Now, follow these steps:
1) Copy the above created XML to your development system
2) Open the problem report in the Crystal Reports designer
3) In the Designer, go to the Database menu and select u201CSet Datasource Locationu201D
4) In the u201CReplace with:u201D pane, expand the u201CCreate New Connectionu201D folder.
5) Double click the u201CADO .NET (XML)u201D icon
6) Browse to the location of the XML file you created in step (1)
7) Click on the path to the XML. The <Update> button should enable
😎 Click on the <Update> button
Typically, either of the following will happen:
You will get a u201CMap Fieldsu201D dialog. This indicates that the XML written off of your dataset does not match what the report is expecting. This may be due to incorrect fields name, incorrect field type, etc. You will now need eliminate the difference.
Incorrect data or no data. There is an issue with your dataset and you need to determine why the data is not present in your dataset. Looking at the XML may be a good place to start.
Ludek
I followed the steps exactly (exporting the Xml to C:\CrystalXml as dsRep.xml and dsSub.xml) updating the Main and the Sub-Report. When I pressed the Update button, no messages where shown for either the main or sub-report (no mapping dialog or logon dialog). When I saved the report it said the below (I saved the report in the new format). The report now runs ONLY on my machine, but NOT on anyone elses machine. We are getting the same Error, as before with a new path now, "cannot find C:\CrystalXml\dsSub.xml" when run from anyone but mine machine.
(I'm thinking about removing the sub-report to test if that is the issue since the error message says "dsSub.xml")
Saving in new verison message:
-
Crystal Reports
-
Warning: This report (C:\xxxx\xxxxFringe.rpt) was saved in a previous version of Crystal Reports using an older report file format. If this report is re-saved in the current version, the report file format will be upgraded to a new file format, which may not be compatible with previous versions of Crystal Reports. For more information consult the 'Importing Earlier Versions of Crystal Reports' section of the Crystal Reports MSDN documentation.
Do you want to upgrade the report to the new file format?
-
Yes No
-
The save as message is ok. Does not really matter if you do or don't. Thought, just to add this piece of the puzzle; what version of CR was the report created in? And confirm you are upgrading to CR 2008 SP1(?).
Did you get the data as expected from the xml you pointed to in the CR designer?
BTW., removing the subreport (as a test) and seeing how things go, is a good idea.
Ludek
Turns out there are two sub-reports on the main report and only one of the sub-reports had its datasource set. So, I guess in VS 2003 this worked (even though not correct) and in VS 2008 I get the above error. Be nice if the error message contained some specific details. We have more reports not working, with the same error message, but at least I know now that the error message is not telling me much.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.