积极答复者
ReportViewer报表,绑定两张数据表时的问题

问题
-
在用了ReportViewer做了一报表,我自己新建了一个TakeDateSet数据集(DataTable),里面包含了二个DataTable,可是在页面里我把数据源给它的时候,只有显示第一Datablel里面的内容,可别的datatable结果出不来,在网上找来一圈,也没整出一个正确的答案,特向各位高人请教,谢谢,我做的是CS的界面,底下是绑定代码:
ReportViewer1.LocalReport.DataSources.Add(newMicrosoft.Reporting.WebForms.ReportDataSource("TakeDateSet_订单信息",dt1));
ReportViewer1.LocalReport.DataSources.Add(newMicrosoft.Reporting.WebForms.ReportDataSource("TakeDateSet_明细信息",dt2));
ReportViewer1.LocalReport.Refresh();
就是从订单信息中读取 订单号,客户名称,工艺要求 显示在表格表头栏中
再从明细信息中读取 规格信息 显示在表格详细信息栏中... (订单号,客户名称此表中也有,但工艺要求没有)
明细信息数据集中我已经有做了按订单号,客户名称的分组,,,
现在就是有一表格表头文本框要显示订单信息表中的工艺要求..如果只有一个
订单可以显示,如果是多个订单时,就没显示了,该怎么对应绑定的操作呀??????
郁闷呀...
答案
-
用sql inner join 放到一个datatable里
http://feiyun0112.cnblogs.com/- 已标记为答案 Cookie Luo 2011年3月8日 2:02
全部回复
-
将表格表头栏中的DATATABLE换成报表的PARAMETER作为参数去处理
ReportParameter rp_CustomerName = new ReportParameter("rp_CustomerName", strCustomerName);
ReportParameter rp_CustomerSex = new ReportParameter("rp_CustomerSex", MaintenanceRptdt.Rows[0]["rp_CustomerSex"].ToString());
this.rptShowView.LocalReport.SetParameters(new ReportParameter[] { rp_CustomerName,rp_CustomerSex});
用的时候用:=Parameters!rp_CustomerName.Value
DATASET的数据源用:
this.rptShowView..LocalReport.DataSources.Add(。。。。。。。。。。。。。)
用的时候用:Fields!colname.Value
yulai
- 已建议为答案 hangyulai 2011年3月1日 5:07
-
用sql inner join 放到一个datatable里
http://feiyun0112.cnblogs.com/- 已标记为答案 Cookie Luo 2011年3月8日 2:02