mvc中rdlc 报表怎么绑定多个数据集

mvc中rdlc 报表怎么绑定多个数据集,第1张

RDL/页面报表中可以添加多个数据源连接(DataSource),每个数据源下可以添加多个数据集(DataSet,该DataSet并非 System.Data.DataSet类型,而是GrapeCity.ActiveReports.PageReportModel.DataSet类型)。

第一步: 在工程中创建一个名为 PageReport_DataSource_MultiSources.rdlx 的页面报表

第二步:从Visual Studio菜单栏中的“视图”->“其他窗口”->“报表资源管理器 V9”中打开ActiveReports报表资源管理器

第三步:在“DataSource1”节点上点击鼠标右键,选择“添加数据集”菜单项,在d出对话框的“查询”选项卡中写入以下SQL查询语句 [Select * from 类别]

详细的 *** 作步骤,请参考下面的博客http://blog.gcpowertools.com.cn/post/2014/08/04/ActiveReports_DataSource_MultiSources.aspx

可以这样添加rdlc ,下面为部分关键代码,看了就懂 我的是C#的,思路就是这样

if (ds.Tables[0].Rows.Count >0)

{

labmsg.Text = ds.Tables[0].Rows.Count.ToString()

ReportDataSource rds = new ReportDataSource("DataSet1", ds.Tables[0])

ReportViewer1.LocalReport.DataSources.Clear()

ReportViewer1.LocalReport.DataSources.Add(rds)

ReportViewer1.LocalReport.ReportPath = "rdl\\YP\\rdlwtdataquery.rdlc"

ReportViewer1.LocalReport.Refresh()

}

else

{

}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11783114.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存