在rdlc报告中添加多个数据集 [英] Add more than one dataset in rdlc report

查看:130
本文介绍了在rdlc报告中添加多个数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在rdlc报告查看器页面中,我编写了以下代码。报表查看器名称为rvInLineRejectionStyleWise。

我在数据集中添加一个表。现在我需要在数据集中添加两个表。请帮我。非常感谢帮助我。

In rdlc report viewer page I have written the following codes. The report viewer name is "rvInLineRejectionStyleWise".
I add one table in dataset. Now I need to add two tables in the dataset. Please help me. Advance thanks for helping me.

DataTable dt = new DataTable();
rvInLineRejectionStyleWise.LocalReport.ReportPath = Server.MapPath("Smt_DefectWiseReport.rdlc");
SqlDataAdapter ad = new SqlDataAdapter("Smt_Defect_Wise_Report '" + strStyleCode + "'", cn);
DataSet ds = new DataSet();
ad.Fill(ds);
ReportDataSource rds1 = new ReportDataSource("DataSet1", ds.Tables[0]);
rvInLineRejectionStyleWise.LocalReport.DataSources.Clear();
rvInLineRejectionStyleWise.LocalReport.DataSources.Add(rds1);





我已编写代码来添加另一个数据集。出现错误本地报告处理期间发生错误。



I have write the code to add another dataset. It arise the error "An error occurred during local report processing."

DataTable dtest = new DataTable();
                    rvInLineRejectionStyleWise.LocalReport.ReportPath = Server.MapPath("Smt_DefectWiseReport.rdlc");//Reports
                    SqlDataAdapter adtest = new SqlDataAdapter("Smt_Defect_Category_Wise_Graph '" + strStyleCode + "'", cn);
                    DataSet dstest = new DataSet();
                    adtest.Fill(dstest);
                    ReportDataSource rds2 = new ReportDataSource("DataSet2", ds.Tables["dtest"]);
                    rvInLineRejectionStyleWise.LocalReport.DataSources.Clear();
                    rvInLineRejectionStyleWise.LocalReport.DataSources.Add(rds2);



我提供剩下的代码:


I provide my rest of the code :

byte[] bytes = rvInLineRejectionStyleWise.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);
               Response.Clear();
               Response.Buffer = true;
               Response.ContentType = "application/pdf";
               Response.BinaryWrite(bytes.ToArray());
               Response.End();

推荐答案

试试这个链接找出你的解决方案..





http:// stackoverflow .com / questions / 13838429 / adding-datatable-to-dataset [ ^ ]

http://msdn.microsoft.com/en-us/library/aeskbwf7(v = vs.110).aspx [ ^ ]
Try this links to find-out your solution..


http://stackoverflow.com/questions/13838429/adding-datatable-to-dataset[^]
http://msdn.microsoft.com/en-us/library/aeskbwf7(v=vs.110).aspx[^]


这篇关于在rdlc报告中添加多个数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆