Solved

Crystal Reports upgrade from 9 to 13

Posted on 2014-11-19
7
620 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Syntax error 9 45
Not showing JavaScript in the list 5 39
Server Error 11 47
Crystal Reports Version 7 4 13
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now