当前位置:编程学习 > C#/ASP.NET >>

ActiveReport 問題

我想知道如何在ActiveReport中設置顯示當前時間

日期和年月就行了  --------------------编程问答-------------------- ............ --------------------编程问答-------------------- 使用ActiveReports可以使用帮顶数据的方式给报表赋值

在这里要用到两个事件:DataInitialize和FetchData。
DataInitialize用来定义字段列表,获取数据等工作,FetchData用来指定每个字段的值。
我们简单定义一个Customer类
public class Customer
        {
                public int ID;
                public string Name;
                public string Address;
    }
再给报表定义一个Customer数组,用来保存要显示的数据,比如:
public Customer[] customers;
还需要一个值来保存当前记录的索引:private int index =0;
接下来在DataInitialize中定义报表有那些字段:
this.Fields.Add("Name");
    this.Fields.Add("Address");
然后在FetchData事件中添加以下代码:
if (this.index >= this.customers.Length )
        {
                eArgs.EOF = true;
                return;
        }
        else
        {
                eArgs.EOF = false;
        }
        this.Fields["Name"].Value = customers[this.index].Name;
        this.Fields["Address"].Value = customers[this.index].Address;
    this.index += 1;


参考
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,