At the same time this error occurred, and I immediately thought,
1. Whether the parameter is set or not; so I'll check it out right away. Is the parameter set? eedle Yes.
2. I have not updated the report template so open the Explorer, copy and update the report template under the Debug/bin directory
Running, or making a mistake?
So I turned to the leader and found my parameter setting was problematic.
A parameter field has been created Count1 (string) has a small and big parameter in the report that references the same count parameter segment
Then recreate the parameter field small and big and refer to the template as shown
Run ok! Success
</pre></p><p><pre name= "code" class= "CSharp" ><span style= "font-size:18px;" > Code: private void Commonfunction () { #region set parameter doc. Setparametervalue ("Year", Getdatebystr (1,this.date.text)); Doc. Setparametervalue ("Month", Getdatebystr (2, This.date.Text)); Doc. Setparametervalue ("Day", Getdatebystr (3, This.date.Text)); Doc. Setparametervalue ("num", this.num.Text); Doc. Setparametervalue ("unit", This.cbUnit.Text + "paragraph"); Doc. Setparametervalue ("Big1", this.txtBig.Text); Doc. Setparametervalue ("Small", Moneyformat (this.txtSmall.Text) + "Yuan"); #endregion this.crystalReportViewer1.ReportSource = doc; } </span>
Note the name of each parameter is the same as the parameter setting the Name property value to be consistent otherwise an exception occurs
An exception occurred when the Crystal Report parameter was assigned: Invalid index