Solved

Crystal Reports upgrade from 9 to 13

Posted on 2014-11-19
7
613 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

13 Experts available now in Live!

Get 1:1 Help Now