【机房合作】报表

        鉴于机房合作时,自己在报表的使用有很多困惑,最近几天又有几个同学提出了同样的问题,写下本篇博文,希望以后可以帮到同学们。


1.新建报表

右击类库——添加——新建项——Reporting——报表



2.设计报表



3.详细配置




确定——下一步——下一步——



将报表的表格内容补充完整(第一行自己填写,第二行选择)



4.将控件与报表结合







5.添加代码

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Report
{
    public partial class frmReport : Form
    {
        public frmReport()
        {
            InitializeComponent();
        }

        //参数类型根据需要自己定义,可以直接将参数定义为datetime类型
        private string startDate = (new DateTime()).ToString();
        private string endDate = (new DateTime()).ToString();

        private void frmReport_Load(object sender, EventArgs e)
        {
            // TODO: 这行代码将数据加载到表“ReportDataSet.T_Account”中。您可以根据需要移动或删除它。
            //参数很重要,一定要把参数(startDate,endDate)写进来
            this.T_AccountTableAdapter.Fill(this.ReportDataSet.T_Account, startDate.Trim(), endDate.Trim());

            this.rptWeek.RefreshReport();  //刷新报表
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            //获得控件的值
            startDate = dtpStartDate.Value.ToString();
            endDate = dtpEndDate.Value.ToString();
            this.T_AccountTableAdapter.Fill(this.ReportDataSet.T_Account, startDate.Trim(), endDate.Trim());

            this.rptWeek.RefreshReport();
        }
    }
}

6.结果




        果然自己总结一遍,清楚的不清楚的都清楚了,所以及时总结很重要。。。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 21
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 21
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值