?
Solved

Crystal Reports upgrade from 9 to 13

Posted on 2014-11-19
7
Medium Priority
?
668 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 101

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 101

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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

800 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