水晶报表参数赋值时出现异常: 无效的索引
2015-01-19 14:36
239 查看
同时出现这个错误,我马上就想到,
1.参数设置是否争取 ;于是马上仔细的检查一遍参数都设置了吗 咿没错
2.我未更新 报表模板了 于是乎打开资源管理器,把该报表模板复制并更新debug/bin 目录下
运行,
还是出错呀?
于是求助了领导发现我的参数设置有问题
创建了一个参数字段count1 (字符串) 在报表中有个small 和big 参数引用了同一个count 参数字段
于是重新创建参数字段small and big 并且在模板上分别引用 如下图所示
运行OK
!success
</pre></p><p><pre name="code" class="csharp"><span style="font-size:18px;">代码:
private void commonfunction()
{
#region 设置参数
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 + " 款");
doc.SetParameterValue("big1", this.txtBig.Text);
doc.SetParameterValue("small", moneyFormat(this.txtSmall.Text) + "元");
#endregion
this.crystalReportViewer1.ReportSource = doc;
}</span>
注意每个参数的名称 与该参数设置Name属性值要保持一致 否则会出现异常
1.参数设置是否争取 ;于是马上仔细的检查一遍参数都设置了吗 咿没错
2.我未更新 报表模板了 于是乎打开资源管理器,把该报表模板复制并更新debug/bin 目录下
运行,
还是出错呀?
于是求助了领导发现我的参数设置有问题
创建了一个参数字段count1 (字符串) 在报表中有个small 和big 参数引用了同一个count 参数字段
于是重新创建参数字段small and big 并且在模板上分别引用 如下图所示
运行OK
!success
</pre></p><p><pre name="code" class="csharp"><span style="font-size:18px;">代码:
private void commonfunction()
{
#region 设置参数
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 + " 款");
doc.SetParameterValue("big1", this.txtBig.Text);
doc.SetParameterValue("small", moneyFormat(this.txtSmall.Text) + "元");
#endregion
this.crystalReportViewer1.ReportSource = doc;
}</span>
注意每个参数的名称 与该参数设置Name属性值要保持一致 否则会出现异常
相关文章推荐
- 推模式中的水晶报表参数赋值
- 水晶报表参数字段在代码中赋值
- 使用水晶报表更新后出现“值不能为 null。 参数名: inputString”
- 水晶报表参数字段动态赋值
- asp.net水晶报表参数字段在代码中赋值的方法
- C#操作IIS创建应用程序池出现异常:无效索引(Exception from HRESULT:0x80070585)
- 水晶报表参数字段在代码中赋值
- asp.net水晶报表参数字段在代码中赋值的方法
- sqldatasource有输出参数时,出现异常“String[2]: Size 属性具有无效大小值 0。”
- 在模态窗口中打开水晶报表页面时出现异常
- 水晶报表参数编程示例代码
- 水晶报表应用高级参数功能
- 完成了对水晶报表中的参数传递的学习
- 水晶报表参数编程示例代码
- 水晶报表应用高级参数功能
- 水晶报表参数编程示例代码
- 解决水晶报表出现登陆框的问题
- 水晶报表10打印为什么总出现一张空白页?
- 在crystalReport(水晶报表)动态输入参数
- 解决把水晶报表下载到客户端过程中,出现下载整个页面(.aspx)或者直接载web页中打开word文件的问题!