摘要:本文主要向大家介绍了C#编程之c#report基本操作赋值,通过具体的内容向大家展示,希望对大家学习C#编程有所帮助。
本文主要向大家介绍了C#编程之c#report基本操作赋值,通过具体的内容向大家展示,希望对大家学习C#编程有所帮助。
//第一步:清除之前的数据
this.rptView.LocalReport.DataSources.Clear();
//第二步:指定报表路径
this.rptView.LocalReport.ReportPath = "Report2.rdlc";
//第三步:构造新的DataTable
DataTable dt = new DataTable("DataTable1");
dt.Columns.Add("Name");
dt.Columns.Add("Score");
dt.Columns.Add("Id");
dt.Rows.Add(new object[] { "语文", 80, "Y0001" });
dt.Rows.Add(new object[] { "数学", 75, "S0001" });
dt.Rows.Add(new object[] { "英文", 96, "E0001" });
//名称不能写错,和报表中的数据集名称一致
ReportDataSource rdsItem = new ReportDataSource("DataSet1", dt);
//此处可以有多个数据源
this.rptView.LocalReport.DataSources.Add(rdsItem);
//第四步:构造参数
List
new ReportParameter("Title",this.txtTitle.Text),
new ReportParameter("Id",this.txtId.Text),
new ReportParameter("Name",this.txtName.Text),
new ReportParameter("Age",this.txtAge.Text),
new ReportParameter("Sex",this.txtSex.Text),
new ReportParameter("Salary",this.txtSalary.Text),
new ReportParameter("Depart",this.txtDepart.Text)
};
this.rptView.LocalReport.SetParameters(lstParameter);
this.rptView.ZoomMode = ZoomMode.Percent;
this.rptView.ZoomPercent = 100;
//第五步:刷新报表
this.rptView.RefreshReport();
本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注职坐标编程语言C#.NET频道!
您输入的评论内容中包含违禁敏感词
我知道了
请输入正确的手机号码
请输入正确的验证码
您今天的短信下发次数太多了,明天再试试吧!
我们会在第一时间安排职业规划师联系您!
您也可以联系我们的职业规划师咨询:
版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
沪公网安备 31011502005948号