RDLC动态绑定表 [英] RDLC dynamic table binding

查看:420
本文介绍了RDLC动态绑定表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来RDLC报告,我的要求很简单。
我已经设计了一个报告,我已设置在该报告中的一些参数来填充动态数据。

I am new to RDLC reporting, my requirement is simple. I have designed a report and i have set some parameters in that report to populate dynamic data.

现在我有一定的要求,显示表动态以及。
所以,我所做的:

Now i have requirement to display table dynamically as well. So what i did:

DataSet InvoiceSummaryDs = new DataSet();
                    DataTable table = new DataTable();
                    table.TableName = "summary";
                    table.Columns.Add( "name", typeof( string ) );
                    table.Rows.Add(Invoice.TotalBooking);
                    table.Rows.Add("£ " + Invoice.BillAmount);
                    table.Rows.Add("£ " + Invoice.BillAmount + "  <br />" + "£ " + Invoice.VatAmount);
                    table.Rows.Add("£ " + Invoice.NetAmount);

                    InvoiceSummaryDs.Tables.Add(table);

                    ReportDataSource rptDataSource = new ReportDataSource("DSPrice", InvoiceSummaryDs.Tables[0]);
                    rv.LocalReport.DataSources.Add(rptDataSource);

                    rv.LocalReport.SetParameters(parms);
                    rv.LocalReport.Refresh();

所以在服务器端code没有问题,但我在报告中得到错误:
错误13集DS_NAME指的是数据源,它不存在。

错误14的Tablix'Tablix1'是报告机构,但该报告没有任何数据集。数据区域未在报告中没有允许的数据集。

在RDLC文件,我创建了同名的DSPrice数据集无来源,因为我想从这里填充从服务器端动态地而不是数据。

In rdlc file i created a dataset with same name "DSPrice" having no source because i want to populate data from server side dynamically not from here.

我已经看到这个例子:

http://www.gotreportviewer.com/
  生成动态RDLC - 表

在动态表结合是可能thorugh动态报表创作,但我不希望创建动态报表。

in which dynamic table binding is possible thorugh dynamic report creation but i dont want to create dynamic report.

任何一个指导我该如何解决?
任何帮助将是AP preciated。

any one guide me what is the solution? any help would be appreciated.

推荐答案

最后,我解决了这个问题我自己。

Finally, i resolved this issue myself.

我的要求的简短的摘要:
我想从绑定code数据集来我RDLC报告表。

Short summary of my requirements: I wanted to bind dataset from code to my RDLC report table.

当我创建RDLC报告表里面它给了我上面提到的错误,为表提供数据源,我有困惑,为什么?我需要从C#代码设置。

when i created table inside RDLC report it gave me above mentioned error to provide datasource for table and i got confused why? i need to set it from C# coding.

然后我才知道RDLC报告不能知道,如果你要,除非你通过编码创建动态报告中提供从code数据源和我did'nt想创建动态报表。

then i got to know RDLC report cant know if you are going to provide datasource from code unless you create dynamic report through coding and i did'nt want to create dynamic report.

解决方案:

1)创建占位符数据集具有您想从code通过同名
2)数据集必须具有相同的列和名称
3)分配一个数据表的数据源里面的报告
4),并使用相同名称的列从编码传递
5)用这种方法,你不会得到这个错误,你可以很容易地通过从code动态数据集。

1) Create place holder dataset having same name that you want to pass from code 2) that dataset must have same columns and names 3) assign that dataset to table datasource inside your report 4) and use same name columns to pass from coding 5) in this way you wont get that error and you can easily pass dynamic dataset from code.

这篇关于RDLC动态绑定表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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