Solved

Crystal Reports upgrade from 9 to 13

Posted on 2014-11-19
7
632 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
  • 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

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

Suggested Solutions

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

820 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