cancel
Showing results for 
Search instead for 
Did you mean: 

VS2008 to VS2010 upgrade runtime problems

Former Member
0 Kudos

I just upgraded some crystal reports developed in VS2008 to VS2010. They worked perfectly fine in VS2008.

Now when I run certain reports in the viewer there is no problem but when called from .NET code with parameters being passed in using SetParameterValue it seems to ignore the parameter used to filter the select for the main report. The query executed on the DB server is then missing the vital where clause and all records are returned instead of just one.

has anyone come across this issue.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Actually what appears to be happening is that the parameters passed in are not be applied before the report is executed.

If i look at the parameter panel there is no value.

However if I run the report in debug stepping though and look at the report document object before attaching it to the viewer this seems to trigger the proper setting of the parameters.

OR

If i call the report in code a second time it works fine then. So the first call ignores the parameter and the second call doesn't.

What am I missing here in the code?

DBConnectionDetails conn = new DBConnectionDetails("regsys", "regsys", "erslserver3", "grs");

ReportDocument rd = new TestReport();

ReportUtilities.setReportDatabase(rd, conn);

rd.SetParameterValue("EntityId", txtEntityId.Text);

this.crystalReportViewer1.ReportSource = rd;

this.crystalReportViewer1.Zoom(75);

Edited by: ERSRAW on Oct 20, 2011 5:52 PM

former_member183750
Active Contributor
0 Kudos

Web or Win app?

What is the version of the crpe32.dll in C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86

As a test, comment out rd.SetParameterValue("EntityId", txtEntityId.Text); and let the report prompt for the parameters. What happens if you fill out the params manually now?

What is in ReportUtilities.setReportDatabase(rd, conn); - e.g.; what does it implement?

Ludek

Follow us on Twitter http://twitter.com/SAPCRNetSup

Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

Answers (3)

Answers (3)

Former Member
0 Kudos

As far as I can see this is a bug. I have got my project to work as it should by referencing the VS2008 version of crystal. However, this mean the reports have to be maintained in VS2008 going forward, not very satisfactory.

I have now uninstalled and re-installed CRVS2010 (RTM version and then SP1) and the same problem exists even when I create a simple report in a brand new project to select a specified country from a table of countries.

The first time I run the report all countries appear. The next time, the one I specify appears. This does not happen for CRVS2008.

I have now resorted to opening a single case support incident.

Edited by: ERSRAW on Oct 25, 2011 4:23 PM

Former Member
0 Kudos

Win App.

13.0.1.220

Can't seem to get the parameter form to appear when commenting the setparametervalue line out.

the code in the call to ReportUtilities.setReportDatabase(rd, conn) merely sets the Database for each report/subreport.

public static void setReportDatabase(ReportDocument reportDocument, DBConnectionDetails dbDetails)

{

ConnectionInfo connection = new ConnectionInfo();

connection.DatabaseName = dbDetails.DbName;

connection.ServerName = dbDetails.Url;

connection.UserID = dbDetails.Username;

connection.Password = dbDetails.Password;

foreach (CrystalDecisions.CrystalReports.Engine.Table table in reportDocument.Database.Tables)

{

// Cache the logon info block

TableLogOnInfo logOnInfo = table.LogOnInfo;

// Set the connection

logOnInfo.ConnectionInfo = connection;

// Apply the connection to the table!

table.ApplyLogOnInfo(logOnInfo);

//table.Location = table.Location.Replace("dev", "test");

}

foreach (CrystalDecisions.CrystalReports.Engine.Section section in reportDocument.ReportDefinition.Sections)

{

// In each section we need to loop through all the reporting objects

foreach (CrystalDecisions.CrystalReports.Engine.ReportObject reportObject in section.ReportObjects)

{

if (reportObject.Kind == ReportObjectKind.SubreportObject)

{

SubreportObject subReport = (SubreportObject)reportObject;

ReportDocument subDocument = subReport.OpenSubreport(subReport.SubreportName);

foreach (CrystalDecisions.CrystalReports.Engine.Table table in subDocument.Database.Tables)

{

if (table.Name != "RegSysReports_clsImage")

{

// Cache the logon info block

TableLogOnInfo logOnInfo = table.LogOnInfo;

// Set the connection

logOnInfo.ConnectionInfo = connection;

// Apply the connection to the table!

table.ApplyLogOnInfo(logOnInfo);

//table.Location = table.Location.Replace("dev", "test");

}

}

}

}

}

}

former_member183750
Active Contributor
0 Kudos

Can't seem to get the parameter form to appear when commenting the setparametervalue line out.

- That would appear to be a pretty big problem(?). What version of CR were these reports developed in?

A bit of troubleshooting;

back up the report. Remove the subreport(s) from the report. Runt he report in a new Win app:

CrystalReportsViewer1.ReportSource = <path to report>

Run. Let the app prompt for the DB logon and see if you get the param prompt now...

- Ludek

Former Member
0 Kudos

The reports were originally created in VS2005. It is a problem as we are migrating an existing system or a customer and there are 40-50 reports like this. Also, note the reports are embedded in another project DLL and are not loaded from file system.

HOWEVER I created a brand new simple report with no sub reports, the same thing happens.

Whats points me to a bug is that if I debug stepping through the code and examine the Report Document (RD) object after assigning it to the viewer report source it then works fine when i hit continue again. By examine I mean hovering over it with the mouse and expanding the object inspector pop-up to view the RD properties. The object browser pop-up seems to trigger something to cause the parameter's to take affect. Also, it is all OK when I export the RD directly to PDF instead of using the viewer.

In fact your own sample code has the same problem - see CS_Win_RDObjMod_Parameters in the Tutorial Sample Code. From what I can see the report should only display customers from Paris/Tokyo when it first starts but it shows all customers.

former_member183750
Active Contributor
0 Kudos

I'm thinking a phone call may be the quickest way out of this:

http://store.businessobjects.com/store/bobjamer/en_US/pd/productID.98078100?resid=S6I@hgoHAkEAAGsiyV...

- Ludek

Former Member
0 Kudos

If if export directly to PDF it works fine! Crystal driving me mad!

DBConnectionDetails conn = new DBConnectionDetails("regsys", "regsys", "erslserver3", "grs");

ReportDocument rd = new TestReport();

ReportUtilities.setReportDatabase(rd, conn);

rd.SetParameterValue("EntityId", txtEntityId.Text);

//To create PDF from the crystal report

string RepExpName = "C:
Temp
TestReport" + ".pdf";

rd.ExportToDisk(ExportFormatType.PortableDocFormat,RepExpName);

//Preview the generated PDF

System.Diagnostics.Process.Start(RepExpName);