cancel
Showing results for 
Search instead for 
Did you mean: 

Data missing when running in Release vs. Debug

Former Member
0 Kudos

I have an invoicing program that we have been using for a few years now. The invoices are viewed using CR in a .NET environment. One of the subreports lists some line item detail. This particular subreport has just two fields. It gets an ID as a parameter and calls a stored procedure on a SQL server passing the ID and gets a list of description and money fields in return.

The report was created, and is maintained, using CR 2008 version 12.3.3.812. The program was developed in VB.Net using VS 2008. Everything has worked fine for a long time.

Recently, I upgraded the program to use VS 2010 and CR for VS 2010, version 13.0.1 and a very strange thing began happening. I noticed that the subreport had stopped showing the dollar amount after the description. However, if the program is bullt in DEBUG mode, with no other changes, the dollar amount shows up just fine.

I did some playing around and in that process I added a third field to the subreport. This field displayed NULL if the dollar amount was null, T if it was > 0, and F otherwise. In the DEBUG version, this new field displays T, as I would expect. In the RELEASE version, however, the new field displays NULL.

So in the RELEASE version, Crystal is getting a NULL back for the money field but the stored procedure isn't returning a null.

I did try writing a new simple test program that uses the same report. It has no problems in either the DEBUG or RELEASE modes.

I am at a loss to figure out what is going on here. I would appreciate any ideas that anyone may have as to what I can try to fix, or get around, this problem.

TIA,

David

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi David,

How are you getting the data and connecting to the data? OLE DB, ODBC, Record Sets, Data Sets and which driver are you using?

Also, is your app 32 or 64 bit?

Thanks

Don

Former Member
0 Kudos

The data is being returned from a SQL server via an OLE DB connection using the SQL Native Client (SQLNCLI).

All data in the main and subreports are fetched via a call to a stored procedure using the above connection.

The app is a 32-bit app running on a 64-bit system.

Thanks,

David

0 Kudos

Hi David,

That could be why. Is your SQL Server version 2008? If so then update your reports to use the MS SQL Native 10 driver. MS changed the name of their client from SQLNCLI to SQLNCLI10.dll and CR 2008 needs an update with Fix Pack 3.4. CR for VS 2010 has the fix.

If it is then you also need to install the SQL Client tools on the app server. You can download the MSI from MS's download pages, 32 or 64 bit client.

You also need to update your reports using the Set Location and select the new driver. You could use the replace connection method but better to update the reports themselves.

The MDAC/WDAC version of the SQL Native Client may work with 2008 but I've found it's not reliable and unpredictable in results.

Thanks

Don

Former Member
0 Kudos

Hi Don,

First let me take a moment to thank you for providing input on this issue. It is appreciated.

Yes, we are using SQL Server 2008. I applied Fix Pack 3.6 to my CR 2008 and updated all of the connections in the report to use the SQL Native Client 10 driver. We are not running this from an app server so the SQL Client Tools were not necessary.

I had hopes this would make a difference but, alas, the problem persists. Running the report directly out of CR 2008 works perfectly. However, building and running my .NET application in RELEASE mode does not. That one field is missing.

Do you have any other thoughts on things I might try in order to get to the bottom of this?

Thanks,

David

0 Kudos

Hi David,

Very strange... Can you run Profiler and and compare the SQL being sent from debug/release?

Do you have a support Contract? If so can you log a case and let me know what the case number is and I'll grab it.

I've heard and seen issues with runtime because the debug versions used in VS are different than the Release versions but I've never heard of issues in database results.

When you run this report in CR Designer which results do you get? Then Export from your app to RPT format so it has saved data and then check to see if the data is missing in CR Designer, if it is then refresh the report to see if it gets the data. If it shows the missing data then something in the app is causing this.

Are you using shared Variables?

Edit the report and move things around a bit or expand one of the sections so it generates more pages, not more data, there is a known issue with shared variables and depending on where the page breaks are there is missing data. Changing the layout so it alters where the page breaks are confirms if this is the same issue.

Thanks

Don

Former Member
0 Kudos

Hi Don,

You have given me a lot to check into and I appreciate it. Here is what I can report.

We do not have a service contract so I couldn't open a case.

Running profiler shows that there is no difference in the calls made when running Debug or Release. I even went so far as to modify the stored procedure that is being called to record the data being returned in a separate table and in both cases, the same data is being returned.

In my career, I have dealt with many problems that arise because of a difference between Debug and Release code due to code optimizations, data alignment, etc. But, as you stated, I have never seen something that affects database results.

Regarding running this in CR Designer... First, remember that we develop these reports in CR 2008. When the original report is run in this environment, it returns the data correctly. When I save the report from the app in an .rpt file and then open it in CR 2008 it gives me a warning that the report was created with a later version but it does open it. In this case, the dollar fields are missing the data. If I refresh the report, the data shows correctly.

If I open the report in Visual Studio I, of course, get the notice that I am going to be saving the report in an updated format. When I run the program in Release mode, the data is still missing. Saving this report and then opening it using the CR Designer within Visual Studio, the data is still mising. Clicking the refresh buton and then indicating to use the existing parameters does not show the missing data. However, I am suspecting that it is simply refreshing the data from the .rpt file. If I tell it to not save the data in the report, save the report, then refreash the data, the missing data shows up.

It has been 3 years since I first created this report. I don't believe that I am using shared variables in this report. I looked around in the report and didn't see a way to easily tell if there are any there. I have only used them once or twice in the past so I am not well versed in their use. I did, however, try and move some things around in the report to change the page breaks but it didn't make any difference.

As far as what the app does, it has a form that has a CR viewer control on it. When the form is loaded, it sets the connection information in the report as well as the parameters. Nothing else is done in the code behind.

I wanted to be sure that the mixing of CR 2008 and CR for VS2010 wasn't causing issues. I opened the report in VS and saved it in the latest format. I then removed everything from my form and re-added the CR viewer component. As I was playing around with this I had to deal with a few issues where an external component to CR was thowing an error. I didn't get that figured out but when I started with a clean form that problem didn't exist. Once all was in place with the latest stuff, the problem still exists exactly as it did before.

This is really baffling. All indications are that the data is being returned but CR doesn't seem to be getting it correctly.

Have you any other thoughts?

One other thing I tried, in the Load event of my form, I put in the code to directly export the report to a .pdf file. The .pdf contains exactly the same data as the CR Viewer control, which is to be expected. I just wanted to eliminate a problem with the viewer.

Regards,

David

Edited by: CDavidOrr on Jul 18, 2011 12:37 AM

0 Kudos

Hi David,

Great info, this is very strange. Our DB drivers do have separate routines depending on which engine is calling the dll but I've never heard of basic missing data before between debug and runtime....

A Shared Variable is anything like StringVar MyString := ""; or numbers etc....

CR for VS 2010 now comes with a database logging dll: [1553469 - How to enable Database logging in Crystal Reports for Visual Studio 2010|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333533353333333433363339%7D.do]

Hopefully the link works but if not search for it and wrap the title in double quotes and it should be the first one returned.

See if the logs show any missing data between debug and release.

If it doesn't, and this is a serious issue, I'll contact you to get the report and database files from you so I can try to duplicate the problem....

Very strange...

Have you tried also using a ODBC or OLE DB, which ever one you are not using now? I'm wondering if it's driver layer causing the problem....

Thanks again

Don

Former Member
0 Kudos

Hi Don,

Okay, we finally have something concrete. I feel a little foolish here as I should have been thorough enough to check this.

In the past, we had our programs set up to run in 32-bit mode. We recently changed that to allow them to run in 64-bit mode. However, what I neglected to do was to change the configuration when building in Debug mode. So, this is NOT a Debug vs. Release issue. It is a 64 vs. 32 bit issue. When the program runs in 32 bit mode, under either Debug or Release, it works. When running under 64 bit mode, under either Debug or Release, it does not work.

So, since there isn't a 64 bit logging dll, I can't get a log when the error happens.

So, in a strange way I am happy about this as I can at least get my program to work. However, that still leaves the problem. If you wish to continue to pursue this I am happy to do so but the criticality of the issue just took a nose dive.

David

Edited by: CDavidOrr on Jul 19, 2011 2:55 PM (Man, was I stuck in the past!)

0 Kudos

Ah, that would be why.... install the 64 bit version of SQL Server Client Tools and then it should work. I kind of recall the 64 bit had to be installed first to make it work. So you may have to uninstall the 32 bit client first.

I do have a 64 bit version of CRlogger now, it'll be included with SP2, but it's not required now...

Also, I did ask if you were running 32 or 64 bit mode. The IDE is 32 bit mode only, debugging 64 bit sometimes works....

Thanks

Don

Edited by: Don Williams on Jul 19, 2011 8:15 AM

Former Member
0 Kudos

Hi Don,

Yes, you did ask about 32 vs. 64 bit mode and I apologize for getting it wrong. When I checked I must have looked at the Debug configuration rather than the Release configuration.

I have the 64 bit version of SQL Server 2008 R2 installed on my development system. However, when I checked, I had not installed all of the client tools. I went ahead and installed everything. Unfortunately, the problem in 64 bit mode remains. I built the app for 64 bit and ran it outside of VS so that the IDE would not be a factor.

I am satisfied with running the app in 32 bit mode. However, if you think this might be a problem in CR and would like to continue to pursue and identify it I would be happy to do so.

Thanks,

David

Answers (0)