handleeldnah
Programmer
Hello,
I am trying to use a WebService(.net) built based on a Crystal report that uses an parameter(address.code).
When I build the Client to access the WebService I used the attached code in order to send the parameter values.
If I try to access the Client in Internet Explorer, I get
"Exception Details: System.InvalidCastException: Specified cast is not valid.
"
I commented out the last line and it seems that there is the problem.
How could I solve this?
base.OnInit(e);
CrystalReportViewer1.ReportSource = new localhost.TenantsService();
// Declare variables needed to pass the parameters
// to the viewer control.
ParameterFields paramFields = new ParameterFields ();
ParameterField paramField = new ParameterField ();
ParameterDiscreteValue discreteVal = new ParameterDiscreteValue ();
// The first parameter is a discrete parameter with multiple values.
// Set the name of the parameter field, this must match a
// parameter in the report.
paramField.ParameterFieldName = "addrcode";
// Set the first discrete value and pass it to the parameter.
discreteVal.Value = "Smith";
paramField.CurrentValues.Add (discreteVal);
// Set the second discrete value and pass it to the parameter.
// The discreteVal variable is set to new so the previous settings
// will not be overwritten.
discreteVal = new ParameterDiscreteValue ();
discreteVal.Value = "ABCSuppli";
paramField.CurrentValues.Add (discreteVal);
// Add the parameter to the parameter fields collection.
paramFields.Add (paramField);
// Set the parameter fields collection into the viewer control.
// Here the left part has unknown value and it gave the error
CrystalReportViewer1.ParameterFieldInfo = paramFields;
I am trying to use a WebService(.net) built based on a Crystal report that uses an parameter(address.code).
When I build the Client to access the WebService I used the attached code in order to send the parameter values.
If I try to access the Client in Internet Explorer, I get
"Exception Details: System.InvalidCastException: Specified cast is not valid.
"
I commented out the last line and it seems that there is the problem.
How could I solve this?
base.OnInit(e);
CrystalReportViewer1.ReportSource = new localhost.TenantsService();
// Declare variables needed to pass the parameters
// to the viewer control.
ParameterFields paramFields = new ParameterFields ();
ParameterField paramField = new ParameterField ();
ParameterDiscreteValue discreteVal = new ParameterDiscreteValue ();
// The first parameter is a discrete parameter with multiple values.
// Set the name of the parameter field, this must match a
// parameter in the report.
paramField.ParameterFieldName = "addrcode";
// Set the first discrete value and pass it to the parameter.
discreteVal.Value = "Smith";
paramField.CurrentValues.Add (discreteVal);
// Set the second discrete value and pass it to the parameter.
// The discreteVal variable is set to new so the previous settings
// will not be overwritten.
discreteVal = new ParameterDiscreteValue ();
discreteVal.Value = "ABCSuppli";
paramField.CurrentValues.Add (discreteVal);
// Add the parameter to the parameter fields collection.
paramFields.Add (paramField);
// Set the parameter fields collection into the viewer control.
// Here the left part has unknown value and it gave the error
CrystalReportViewer1.ParameterFieldInfo = paramFields;