Don, you actually solved part of the problem - in thrashing around trying to figure out what was going wrong, I followed the suggestion of a post on another site and moved the database connection to before the setting of the parameters. And of course, nothing worked. I moved the connection back to its original location as you suggested, just before I set the viewer to use the report, and most of my reports are working again.
I also had to go through each report and reconnected it to the database and recreated the parameter links between parent and child reports, and this seemed to have solved most of the problems created by moving to SP12. Reports that were previously prompt for mandatory parameters have stopped doing this behaviour.
However, reports with optional parameters continue to prompt for values, even when the optional prompt value is set. This specified report has one mandatory parameter (Tax Year), and two optional parameters - CompanyID (discrete, single value) and InvestorID (discrete, multiple values). Either one can be set to generate a report, either all YTD Earnings for all Investors associated with a Company or for a specific Investor.
When I am setting the parameter values and I look at the specific parameter which is prompting (InvestorID), I see the following properties have been set:
? directcast( _Parameter ,CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition)
{CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition}
Attributes: Count = 1
CurrentValues: Count = 0
DefaultValueDisplayType: DescriptionAndValue {1}
DefaultValues: Count = 0
DefaultValueSortMethod: BasedOnValue {0}
DefaultValueSortOrder: NoSort {0}
DiscreteOrRangeKind: DiscreteValue {0}
EditMask: Nothing
EnableAllowEditingDefaultValue: True
EnableAllowMultipleValue: True
EnableNullValue: False
EngineObjectFactory: {CrystalDecisions.CrystalReports.Engine.EngineObjectFactory}
FormulaName: "{?InvestorID}"
HasCurrentValue: False
IsOptionalPrompt: True
Kind: ParameterField {6}
MaximumValue: Nothing
MinimumValue: Nothing
Name: "InvestorID"
NumberOfBytes: 8
ParameterFieldName: "InvestorID"
ParameterFieldUsage: Unknown {3}
ParameterFieldUsage2: InUse Or DataFetching {33}
ParameterType: ReportParameter {0}
ParameterValueKind: NumberParameter {0}
PromptText: "Enter InvestorID:"
RasDocument: {CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper}
RasField: {System.__ComObject}
RasObject: {System.__ComObject}
ReportName: ""
UseCount: 1
ValueType: NumberField {6}
? directcast( _Parameter ,CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition).CurrentValues.IsNoValue
True
Note that IsOptionalPrompt is set to true.
In my code, when I am setting the values for this parameter, which can be multi-valued, I use the following code:
Dim pdv AsParameterDiscreteValue
With _parameter.CurrentValues
.Clear()
SelectCase _IDs.Count
Case 0
.IsNoValue = True
Case 1
Report.SetParameterValue(_parameter.ParameterFieldName, _IDs(0))
Case Else
ForEach paramValue AsInt32In _IDs
pdv = .AddValue(paramValue)
Next
EndSelect
EndWith
When there are no values, the first case statement is fired. In the debugger, I see the value:
? directcast( _Parameter ,CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition).CurrentValues.IsNoValue
True
I then continue on to allow the report to run, and get the following exceptions when the report is running, and a prompt for the InvestorID.
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in CrystalDecisions.CrystalReports.Engine.dll
A first chance exception of type 'CrystalDecisions.CrystalReports.Engine.ParameterFieldCurrentValueException' occurred in CrystalDecisions.ReportAppServer.DataSetConversion.dll
A first chance exception of type 'CrystalDecisions.CrystalReports.Engine.ParameterFieldCurrentValueException' occurred in CrystalDecisions.CrystalReports.Engine.dll
A first chance exception of type 'CrystalDecisions.CrystalReports.Engine.ParameterFieldCurrentValueException' occurred in CrystalDecisions.ReportSource.dll
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in System.Windows.Forms.dll
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in System.Windows.Forms.dll
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in System.Windows.Forms.dll
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in System.Windows.Forms.dll
These may be normal exception errors, I don't know.
Please let me know how to upload a copy of the report and what else you might need to examine it.
Thanks, Neil