Solved

Crystal Reports upgrade from 9 to 13

Posted on 2014-11-19
7
646 Views
Last Modified: 2014-11-25
Here's my dilemma: We're upgrading our web app from .NET 1 to .NET 4 and everything is going great. We have 56 reports that we use to output pdf's for correspondence letters, invoices, etc. Everything was working properly when we were running in .NET 1 using VS 2003 and CR 9.

Now we are running CR 13 for VS 2010 and .NET 4 and I have all of these working in the new environment with the new .NET version, except for a handful, all of which rely on a sql view as a report datasource. Possible issue?

The reports load, there are no errors, but the data is missing. Hopefully someone can help.

DataTable dt = new DataTable();
dt = (DataTable)Session["ReportsTable"];
ReportDocument oRpt = new ReportDocument();
string strReport = FSL.FSLReportManager.Reports.GetReportAppSetting(ddm) + objReport.FileName;
oRpt.Load(strReport,OpenReportMethod.OpenReportByTempCopy);
dt.TableName = oRpt.Database.Tables[0].Name;
ExportPDF(this.Page,oRpt,dt);

private void ExportPDF(Page pg, ReportDocument rClass, DataTable dt)
		{   
			rClass.SetDataSource(dt);
                        ExportOptions exp = new ExportOptions();
                        exp.ExportFormatType = ExportFormatType.PortableDocFormat;
                        exp.FormatOptions = new PdfRtfWordFormatOptions();
                        ExportRequestContext req = new ExportRequestContext();
                        req.ExportInfo = exp;
                        System.IO.Stream st;
                        rClass.FormatEngine.ExportToStream(req);
                        st = rClass.FormatEngine.ExportToStream(req);
                        pg.Response.ClearHeaders();
                        pg.Response.ClearContent();
                        pg.Response.ContentType = "application/pdf";
                        byte[] b = new byte[st.Length];
                        st.Read(b, 0, (int)st.Length);
                        pg.Response.BinaryWrite(b);
                        pg.Response.End();
		}

Open in new window


I can verify that the report loads data in the report preview.
I can verify that the datatable contains all of the data.

What am  I missing?
0
Comment
Question by:YPU
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 40453472
Have you tried rebuilding the sql in the report?

Have you tried a VERIFY DATABASE?

What error do you get?

mlmcc
0
 

Author Comment

by:YPU
ID: 40453599
Rebuilding the sql in the report?

Database is verified.

No errors.

Thank you.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 40453823
DO the other reports use the tables directly?

Is the application running on the server or the client?

Have you looked at the table the report returns?
In VB6 there was the msgbox.  Not sure what you have in .Net
Look at the value of
           oRpt.Database.Tables[0].Name

mlmcc
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:YPU
ID: 40454968
I went ahead and deleted the database connection and subsequent database fields, then linked directly to the sql view and inserted the fields into the report.

Now the report errors out on this line:

rClass.FormatEngine.ExportToStream(req);

Stack trace:

[COMException (0x80004005): The system cannot find the path specified.
]
   CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) +0
   CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) +1994
   CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) +802
   DMSUserInterface.CSReports.ExportPDF(Page pg, ReportDocument rClass, DataTable dt) in C:\inetpub\wwwroot\DMSUserInterfaceNew_DMS3\CSReports.aspx.cs:95
   DMSUserInterface.CSReports.OnInit(EventArgs e) in C:\inetpub\wwwroot\DMSUserInterfaceNew_DMS3\CSReports.aspx.cs:81
   System.Web.UI.Control.InitRecursive(Control namingContainer) +186
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2098
0
 

Author Comment

by:YPU
ID: 40455061
And oRpt.Database.Tables[0].Name matches the name of the view in the report
0
 

Accepted Solution

by:
YPU earned 0 total points
ID: 40456002
Welp, I figured it out.

In CR 9 we had used the 'select expert' to add a where clause to the view, and had hard coded an account number to push relevant data into the report.

I deleted the record selection and now the data displays in the report.

¯\_(ツ)_/¯
0
 

Author Closing Comment

by:YPU
ID: 40464099
I was able to solve this issue by checking the SQL in the report, and noticing the where clause. I removed the select expert record and all is well.

I highly recommend avoiding Crystal Reports at all costs.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Can I skip a node in XML? 9 46
Header Font Size in Grid View 6 49
CTRL P does not work on Crystal Report Viewer 7 41
Crystal Reports Watermark suppress in groupfooter 6 34
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question