使用ActiveReports for .net 进行报表开发(八)--显示合计
来源:互联网 发布:索尼手机镜头软件 编辑:程序博客网 时间:2024/06/03 17:59
在报表开发中我们常常要显示合计,比如销售记录,要显示单价,售出件数,合计金额等。
我们可以在从数据库中提取数据的时候就使用SQL来产生一个合计字段,也可以在ActiveReport中进行,有两种方法可以使用。
1. 使用ActiveReport中的Label或TextBox控件的DataField属性。例如,要使一个TextBox显示合计,它的值是由单价和售出件数的乘积。设置TextBox的DataField值为“=单价*售出件数”。然后编写代码,加载数据,设置Field集合,然后在FetchData事件中给Field赋值,就可以完成了,例如:
this.Fields["ProductName"].Value = row.productName;
this.Fields["UnitPrice"].Value = row.unitPrice;
this.Fields["Quantity"].Value = row.quantity;
2. 不对DataField属性使用表达式,而是直接在FetchData中进行计算,例如:
double quantity = Convert.ToDouble(this.Fields["Quantity"].Value);
double unitPrice = Convert.ToDouble(this.Fields["UnitPrice"].Value);
this.Fields["ExtendedPrice"].Value = quantity * unitPrice;
当然要在报表上显示要设置Label或TextBox的DataField属性为ExtendedPrice
- 使用ActiveReports for .net 进行报表开发(八)--显示合计
- 使用ActiveReports for .net 进行报表开发(八)--显示合计
- 使用ActiveReports for .net 进行报表开发(七)--事件
- 使用ActiveReports for .net 进行报表开发(七)--事件
- 使用ActiveReports for .net 进行报表开发(七)--事件
- 使用ActiveReports for .net 进行报表开发-交叉报表
- 使用ActiveReports for .net 进行报表开发--交叉变换背景
- 使用ActiveReports for .net 进行报表开发(五)—交叉报表
- 使用ActiveReports for .net 进行报表开发(六)--导出报表
- 使用ActiveReports for .net 进行报表开发(五)—交叉报表
- 使用ActiveReports for .net 进行报表开发(六)--导出报表
- 使用ActiveReports for .net 进行报表开发(五)—交叉报表
- 使用ActiveReports for .net 进行报表开发(六)--导出报表
- 使用ActiveReports for .net 进行报表开发(九)--End User
- 使用ActiveReports for .net 进行报表开发(十)--交叉变换背景
- 使用ActiveReports for .net 进行报表开发(十一)--迁移到3.0
- 使用ActiveReports for .net 进行报表开发(九)--End User
- 使用ActiveReports for .net 进行报表开发(十)--交叉变换背景
- Halcon学习之找出焊接点
- Java利用POI生成Excel强制换行
- 物联网概念
- sql exists用法
- javax.servlet.ServletException: Servlet execution threw an exception
- 使用ActiveReports for .net 进行报表开发(八)--显示合计
- 一个简单方法完成C#时间间隔的计算
- 使用ActiveReports for .net 进行报表开发(九)--End User
- 短信群发接口测试2(vb+dll)
- 使用ActiveReports for .net 进行报表开发(十)--交叉变换背景
- windows xp sub 232在哪下载
- eclipse快捷键
- 使用ActiveReports for .net 进行报表开发(十一)--迁移到3.0
- 严重: Servlet.service() for servlet action threw exception org.apache.struts.chain.commands.InvalidPathException: No action config