c# winform 程序 开发环境 vs2010 。 要使用报表rdlc,这时候需要绑定数据源,xxx.xsd. 的数据集。 如果绑定数据库的表结构的话 有2个问题, 1.表可能放的是很多外键, 这不是我要显示在报表中的内容。 2. 破坏了三层结构。 所以新建了一个.xsd 数据集,DataSet1, 在DataSet1中 新建了一个表dt。 这个表的字段结构就是我要显示的。然后用rdlc去绑定这个数据集。 这个表现在是没有数据的。 数据我是从Bll层得到存放在另外一个表 dt1里。(这2个表的结构是一样的)。 问题是我该如何让这个dt1 去填充DataSet1里的dt. 或者告诉我有没有别的办法去处理rdlc,比如直接把dt1 绑定到rdlc 绕过DataSet1. 这个我不会。 求教
解决方案 »
- c# 创建 调用 dll文件
- C# pictureBox.Image.Save问题
- 是这几个Session函数的问题还是我配置了什么,让我老是得不到想要的结果
- 请问有没有JavaScript的编写环境
- Log4net高级应用(多参数,写数据库)!(顶有分)
- 菜鸟求教!c#怎样实现客户端浏览器在一定时间内没有刷新页面,客户端的浏览器的页面就自动关闭。
- combox和panel的使用
- 散散分哈!关注一下,一个关于网页视频播放模块的实现方法。
- 关于CrystalReports:为什么要显示报表时,要求输入服务器名、数据库名等?(windows application)
- 高分求救。好不容易从网上下载了VS。net 在安装CD3时总是出现错误?各位安装时出现没有?
- listvie滚动条不能够正常显示
- winform做的程序可以在win phone7的平板上面跑吗?
// //ReportParameter rp2 = new ReportParameter("上期销售", 上期销售);
// //ReportParameter rp3 = new ReportParameter("标题", 标题); this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });
Microsoft.Reporting.WinForms.ReportDataSource reportDataSource = new ReportDataSource(); reportDataSource.Name = "paymentdtl"; //指定数据源的名字,是你在设计器中指定的
reportDataSource.Value = dsForGrid.Tables["paymentdtl"];//指定数据源,也就是你查出来的dataTable
reportViewer1.LocalReport.DataSources.Add(reportDataSource); //this.reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
//this.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent;
//this.reportViewer1.ZoomPercent = 100;
//this.reportViewer1.RefreshReport();
this.reportViewer1.RefreshReport();
}
RepView.LocalReport.ReportPath = "Print\\RDLC\\" + StrFileName + ".rdlc";
//绑定数据源
//注意dataset1必须和你报表所引用的table 一致
//DSView 要打印的数据集
foreach (DataTable dt in DSView.Tables)
{
ReportDataSource rds = new ReportDataSource(dt.TableName, dt);//注意这里的name和报表中的一致
RepView.LocalReport.DataSources.Add(rds);
}
// 参数 HTPam 参数集合
if (HTPam != null && HTPam.Count > 0)
{
ReportParameter[] PS = new ReportParameter[HTPam.Count];
int i = 0;
foreach (DictionaryEntry de in HTPam)
{
PS[i] = new ReportParameter(SafeConvert.SafeString(de.Key), SafeConvert.SafeString(de.Value));
i++;
}
RepView.LocalReport.SetParameters(PS);
}