Skip to Content
avatar image
Former Member

Crystal Reports Not Accepting Parameters From Visual Studio 2015 Program

I just upgraded my application from Visual Studio 2005 to Visual Studio 2015 and I use Crystal Reports within my program to run my reports. The problem is when I run the reports from my application in VS2015, it gives me every record in the database. When I run in VS2005, it would give me only the records that matched the specified criteria. It has been working fine for several years in VS2005.

In my code, I do the following:

<code>Reports.crDailyProductionByCsr myRpt =newReports.crDailyProductionByCsr();<br>
ConfigureCrystalReports(myRpt);
InitReportParameters();// Initialize the report parameter fields
AssignReportValue(@"CompanyName","Company Name");
AssignReportValue(@"ReportTitle","Daily Production ");
AssignReportValue(@"DefaultNullValue",'2000-01-01');
AssignReportValue(@"CSRId",CSRId);// Move the Parameters to the report
SetReportParameters();
DisplayReport(myRpt);

// SetReportParameters takes the ReportField values from the program and
// moves them to myPFields for Crystal Reports. I have verified the values
// are correctly filled into ReportField from the AssignReportValue methods
// above.
privatevoidSetReportParameters(){

for(int i =0; i <UsedReportFieldCount; i++) {
myPField[i].ParameterFieldName=ReportField[i];
myDValue[i].Value=ReportFieldValue[i];
myPField[i].CurrentValues.Add(myDValue[i]);
myPFields.Add(myPField[i]);
}
}

privatevoidDisplayReport(ReportDocument myRptDoc)
crvViewer.BackColor=System.Drawing.SystemColors.Control;
crvViewer.ParameterFieldInfo= myPFields;// ParameterField[]
crvViewer.ToolPanelView=CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
crvViewer.ReportSource= myRptDoc; crvViewer.Zoom(90);
}

When I run this in the viewer in Visual Studio 2015, I get the expected results fine. But when I run from my program, it returns all daily production records in the whole database concluding that for some reason the code is not passing the parameter values correctly to the report.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 22, 2017 at 03:29 PM

    Hi Allan,

    CR no longer installs the runtime for applications. All runtime is available from this WIKI:

    https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

    Read the info on that page, it does have a lot of info required.

    On that page there is a sample app as well on using Parameters.

    Don

    Add comment
    10|10000 characters needed characters exceeded