cancel
Showing results for 
Search instead for 
Did you mean: 

Desktop Application hangs after upgrading to Visual Studio 2010 and SAP crystal reports for VS 2010

Former Member
0 Kudos

Hello,

I have a desktop application that was developed in VS 2005. Recently I upgraded the solution to VS 2010. It prompted me that I should install the SAP crystal report separately and I installed the Crystal Report for Visual Studio 2010 installation.

The rpt files were developed using Crystal Report 9.

However after the upgrade the reports fails to display. If i debug the code and step through the crystal report will display the first time i select a rpt but hangs the second time i select another rpt. I created a simple crystal report using Crystal Report 9 and it works with my upgraded application. But my original complex report does not load. It hangs saying Please wait while the document is being processed and freezes there.

I am using SQL Server 2008 and I have made sure that I am using SQL Server Native Client 10.

I use an ODBC(RDO) in my simple report and complex report.

I tried upgrading my complex crystal report using Visual Studio 2010 interface. This did not help as well.

Here is the code that I use to display the report. It works in the old Visual Studio.

 

ReportDocument rd = new ReportDocument();

          

 

rd.Load(reportPath + cmbReport.Text);

rd.SetDatabaseLogon(userID, pwd, WNPOCDataPvd.DSN, string.Empty);

  

                              TableLogOnInfos infos = new TableLogOnInfos();

                              foreach(Table t in rd.Database.Tables)

                              {

                                        TableLogOnInfo inf = t.LogOnInfo;

                                        ConnectionInfo connect = inf.ConnectionInfo;

                connect.ServerName = WNPOCDataPvd.DSN;

                connect.DatabaseName = string.Empty;

                connect.UserID = userID;

                connect.Password = pwd;

                         

         

                                        t.ApplyLogOnInfo(inf);

                                        infos.Add(inf);

                              }

          

    

            crystalReportViewer1.LogOnInfo = infos;

       

            crystalReportViewer1.ReportSource = rd;

Few issues I noticed

1) The upgraded code (VS 2010) is able to display a simple report but not my complex report. The previous version was able to display my complex report.

2) If I step through the code (debug), then my complex report will display the first time, but if I try to select a new report (from a combo box) and run this code again in debug mode it hangs at crystalReportViewer1.ReportSource = rd;.

3) If I just run the code (without stepping through) then the application hangs.

Thanks

Anina

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Before selecting a new report, ensure that you use .Close and .Dispose on the 1st report.

- Ludek

Senior Support Engineer AGS Primary Support, Global Support Center Canada

Follow us on Twitter

Got Enhancement ideas? Try the SAP Idea Place

Share Your Knowledge in SCN Topic Spaces

Former Member
0 Kudos

Hello Ludek,

Thanks for the response.

I am now able to run the report! But it was a different issue.

I recreated my old report step by step each time making sure that it launches. Finally when I added the pagenumber Page N of M, the issue reappeared.

Is that a feature that is not supported in the crystal report viewer?

I am able to view my report with the pagenumber in the Visual Studio 2010 Main Report Preview window. But once I try to launch it from my application it hangs. Is that a known issue, or am I doing something wrong?

Thanks

Anina

former_member183750
Active Contributor
0 Kudos

It's not an issue I've ever heard of. What CR Service Pack are you on?

Now, Page N of M will force the report to go and fetch all the data and create all the pages for the report. So if a report has a 1,000 pages, it may take some time(?).

- Ludek

Former Member
0 Kudos

I am using CR service Pack 5. The report has 5 pages. I left it to run over night and still it did not display. Usually the report does not take any processing time and appears almost immediately.I can replicate this issue consistently.

Anina

former_member183750
Active Contributor
0 Kudos

Make sure CR 10.2 (bundled with .NET 2005) is uninstalled.

Does the report have any subreports? If so, what section are they in?

As  test, I'd like you to download an eval or CR 2011 from here:

http://www.sap.com/solutions/sapbusinessobjects/sme/freetrials/index.epx

Instal the CR 2011 designer and try to run the report there.

- Ludek

Former Member
0 Kudos

Hi Ludek,

Sorry for the delay. I dont have CR10.2 installed.. But i do have CR 9.2 installed. Since the report is loading correctly now without the page number, i do not want to uninstall now. Will do that once I am done with this work.

The reports do not have any subreports and I have confirmed that This is an issue with even the simplest reports that I build.

The report runs (preview works) fine the the Visual Studio designer even with the page number on but not in the crystal report view within my C# program.

However I am having login issues.

I deployed the C# program in a test PC. But when I load the report in the program I am getting an error related to Logon parameters.

The report seems to be saving the logon information (dsn name, server name etc) from my PC stored somewhere in the rpt. You can check the code in my first post (Question). To make my report load in the test PC I had to open the report using CR 9 in my test PC and perform a Set Datasource location and save it.

I am doing a  rd.SetDatabaseLogon and table.ApplyLogOnInfo(inf) as u can see in my code.

However this seems to be having no effect when it runs in the test PC.

Regards,

Anina

former_member183750
Active Contributor
0 Kudos

Hello Anina

Please try the following code:

Dim crDatabase As Database

    Dim crTables As Tables

    Dim crTable As Table

    Dim crTableLogOnInfo As TableLogOnInfo

    Dim crConnectionInfo As ConnectionInfo

'Setup the connection information structure to be used
        'to log onto the datasource for the report.
        crConnectionInfo = New ConnectionInfo()
        With crConnectionInfo
            .ServerName = "Server1"    'physical server name
            .DatabaseName = "Pubs"
            .UserID = "myuser"
            .Password = "mypassword"
        End With

        'Get the table information from the report
        crDatabase = crReportDocument.Database
        crTables = crDatabase.Tables

        'Loop through all tables in the report and apply the connection
        'information for each table.
        For Each crTable In crTables
            crTableLogOnInfo = crTable.LogOnInfo
            crTableLogOnInfo.ConnectionInfo = crConnectionInfo
            crTable.ApplyLogOnInfo(crTableLogOnInfo)
        Next

If that does not work for you see:

1553921 - Is there a utility that would help in writing database logon code?

- Ludek

Former Member
0 Kudos

Hello,

I just wanted to write a "me too" post for this: I'm experiencing exactly the same behaviour with the 'Page N of M' control in some of our reports.  We also added CR13 support to an application that was supporting (and still does support) CR9.  The CR9 runtime isn't invoked when our application is in "CR13-mode" though (see http://scn.sap.com/thread/3357976).  As with the OP, this is only a problem in installation environments -- it works fine on a dev machine.  (And believe it or not, despite the similarities, this isn't actually the same project as the OP.)

We've further discovered, in our case, that it seems to specifically be the 'of M' part: if we replace the 'Page N of M' control with a 'Page N' control, it works fine; if we further manually add an "of" label and a 'of M' control, the report hangs.

The suggestion by Ludek for logging onto the tables didn't help -- we're actually already doing that.  Moreover, this doesn't happen to us for all reports, but only a specific minority subset of reports -- although we haven't figured out anything special about this subset.  Weirder still, we discovered the following behaviour, with Works_Fine.rpt and Causes_a_Hang.rpt:

   i.  Start Application

   ii.  Run Works_Fine.rpt           --> Crystal works

   iii.  Run Causes_a_Hang.rpt    --> Crystal works(!)

   iv.  Run Works_Fine.rpt           --> Crystal works

   v.  Run Causes_a_Hang.rpt      --> Crystal hangs(!!!)

It doesn't seem to matter how often we repeat Step iv -- the second time we run Causes_a_Hang.rpt, Crystal will hang.  Note that Works_Fine.rpt and Causes_a_Hang.rpt both have the 'Page N of M' control in our case.  There's no obvious difference between the "Works_Fine" reports and the "Causes_a_Hang" reports.

If this means something to anyone, I'd be very interested in hearing it!  (This one has caused a lot of head-scratching here!)

Best,

Kevin

former_member183750
Active Contributor
0 Kudos

This sounds like something very specific to CR 9, pagemn of n and upgrade to CR 13 as I have not seen anything like it other than these two examples.

Kevin, do you see the same behavior if you use Run Works_Fine.rpt   and Causes_a_Hang.rpt with saved data? If you do, would you mind uploading the Causes_a_Hang.rpt?

- Ludek

Former Member
0 Kudos

Hi Ludek,

Thanks for the idea about saving with data.  Unfortunately, saving with or without data doesn't seem to affect the behaviour. 

Unfortunately, I'm not in a position to upload the .rpt file; I also can't come up with a generic .rpt file that demonstrates the problem, since the problem doesn't manifest in generic reports. 

I might have to let this one sit for a while.  Given unlimited time, there are more experiments that I'd like to try (e.g. "What happens if you try the report in an installed environment without CR9?", "It is solved in CR13_0_6?"), but we're late in our release cycle, and these experiments take up a bit too many resources.  Our fall-back plan to replace the "Page N of M" control with simply a "Page N" control has been accepted, so spending too much more time on this right now is a bit frowned on.  I can still sneak in quick experiments though, so I'd still be curious to learn of any "Eureka!" moments.

Thanks as always!

Kevin

former_member183750
Active Contributor
0 Kudos

OK Ken. Many thanks for the update.

Have a great weekend and happy coding,

- Ludek

Former Member
0 Kudos

Hi all,

We stumbled across another data point about this that doesn't mean a lot to us, but maybe it'll make someone else here go "Eureka!".  (I hope I'm not hijacking your thread, Anina!)  We discovered that there are actually two ways to fix Causes_a_Hang.rpt:

  1. [already known] Remove the Page N of M control(s).
  2. [new] Remove all references to Parameters within the report.

It's ok if there are Parameters defined in the report but unused, but the moment that a Parameter is connected to something, it causes the report to hang.

That said, we still can't see anything obviously different about Causes_a_Hang.rpt.  In particular, we have various Works_Fine.rpt files that have both the Page N of M control as well as connected parameters.  Just to reiterate our other weirdnesses:

  1. Causes_a_Hang.rpt works fine on CR9 in a VS2012 environment, CR9 in an installed environment, and CR13 in a VS2012 environment; it only breaks in a CR13 installed environment.
  2. Causes_a_Hang.rpt will work if Works_Fine.rpt is run first.  (This is true even if we use Used_To_Cause_A_Hang.rpt as the Works_Fine report.)

I guess one additional thing worth mentioning is that the CR13 versions of all our reports differ from their CR9 counterparts in that the CR9 versions are "normal" reports, whereas CR13 use a single "hand-coded" Command table (which has the same SQL query as the CR9 version).  Again, this is true of both Causes_a_Hang.rpt and Works_fine.rpt.  (See http://scn.sap.com/thread/3297421.)

 

I'm sorry I still can't post examples of the two types of reports -- I know this is sorta asking the community to go at it blind.  I guess what I'm wondering is whether there are any red flags that I should be looking out for.  For example, we found an unrelated issue where VStudio borks the Selection Formula feature by autogenerating the line of code "crystalReportViewer.SelectionFormula = String.Empty;" in InitializeComponent()).  Is it possible that VStudio is doing something similar with Parameters?  Or do I have to something special to crystalReportViewer.ParameterFieldInfo? (What *is* crystalReportViewer.ParameterFieldInfo, anyway?  Why does the Viewer have ParameterFields independent from the Report?)

As always, thanks for the help/time/effort,

Kevin

former_member183750
Active Contributor
0 Kudos

Hello Kevin

No real Eureka moment, but I just wanted to add that page N of M forces the report to inhale all of the data it will use and format the report so it knows how many pages it will be. E.g.; without the page N of M the report engine retrieves enough data for the 1st page and splashes that on the screen. E.g.; it has no idea how many pages, thus the 1 of 1+. When you page to the next page, the report goes out and retrieves the data for that page. Now the fact that running one report 1st, and then the "bad" report next results in success, makes me wonder about what is happening on the database side; Is it possible the database is being updated and not accessible to that report? Or, are you creating temp tables that the report consumes, but the temp table is not finished (and thus running the good report buys us enough time to complete the writing of the temp table)?

One other issue I came across recently. Report create in CR 10.2 (and perhaps even 10.5) allowed you to create two parameters of the same name (bug we never caught at the time). Anyhow, this would work, but on upgrade this causes issues (usually there is an error thrown; "This document could not be opened", but I suppose other behaviors would not be out of the question.

- Ludek

Former Member
0 Kudos

I've been poring over my reports for 2 days before stumbling across this. Thank you!!!

Removing the "Page N of M" brought me back to sanity. I couldn't for the life of me figure out why the reports were stuck at "Please wait while the document is processing".

Thanks again.

former_member183750
Active Contributor
0 Kudos

Hello Fola

Just to help me to try to put some pattern to this, are your reports created in an earlier version of CR? say CR 9.c or even earlier and you are now trying to run them using CR 2008 or later runtime?

- Ludek  

Senior Support Engineer AGS Product Support, Global Support Center Canada      

Follow us on
Twitter Twitter

Former Member
0 Kudos

Yes. Report was created in CR9 and was previously being run in a VS2005 environment. The application was upgraded to VS2010 with the compatible CR version (CR for VS2010) installed, that's when I encountered the issue of reports just hung at the "processing" stage.

former_member183750
Active Contributor
0 Kudos

Many thanks for the confirmation. That looks to confirm the pattern; may be isolated to reports created in CR 9.x and previous. And that is what I will want to test here. Would you be able to share your report? I do not need "saved data", just the design will be fine as I am more interested in the structure of the report. If yo can attach it, rename it to *.txt, then click on "Use advanced editor" and attach. This will zip up the file automatically.

- Ludek

Former Member
0 Kudos

Here you go!

former_member183750
Active Contributor
0 Kudos

Many thanks. I'll do some work on this next week and post any results here.

Have a great weekend,

- Ludek

former_member183750
Active Contributor
0 Kudos

I've looked at the report and see that you are connecting to MS SQL. Can you please confirm that the following is true?

For OLE DB then use:

MS SQL 2005 - OLE DB Provider

MS SQL 2008 - SQL Native 10

MS SQL 2013 - SQL Native 11

For ODBC then use:

MS SQL 2005 - SQL Native

MS SQL 2008 - SQL Native 10

MS SQL 2013 - SQL Native 11

My next step is to go and look for old reports that we may have and see if I can run those in CRVS.

- Ludek

former_member183750
Active Contributor
0 Kudos

One more favor, if I can pls.

Cab you try to run the attached report? I did a minor mod (the "m of n") field is stil there.

- Ludek

Answers (0)