从 Web 服务返回的数据表填充 .Net 报表查看器控件

发布于 2024-10-06 09:17:24 字数 356 浏览 8 评论 0原文

预先感谢您的任何帮助。看起来我想做的事情应该非常简单,但是在互联网上搜索了几天之后,我似乎找不到一个答案,可以以一种简单的方式将其完全拉出来,适合经验丰富的.Net开发人员。到报告查看器。

很简单,我想要的是以下问题的示例或分步演示: 如何使用从 Web 服务返回的数据表填充 .Net Report Viewer 控件?在 Web 服务中,调用一个存储过程,该过程返回最终在发送回应用程序的 DataTable 中的内容。更喜欢 C# 答案,但 VB 也很好,因为我对它相当熟悉。

与此相关的问题是: 1.返回的DataTable是否需要有列名和类型(是否需要强类型)?
2)如果是这样,我在设计报表时是否需要知道这些列名称/类型,或者有没有办法动态创建?

Thanks in advance for any assistance. It seems like what i'm trying to do should be very simple, but after literally days of scouring the internet I can't seem to find an answer that pulls it altogether in a simple fashion suitable for an experience .Net developer who is new to the Report Viewer.

Very simply, what I want is an example or step by step demo for the following question:
How do I populate a .Net Report Viewer control using a Data Table returned from a web service? Within the web service a stored proc is called that returns what eventually ends up in the DataTable that gets sent back to the application. Would prefer C# answer, but VB is also fine as i am fairly familiar with it.

Related questions to this are:
1. Does the returned DataTable need to have column names and types (does it need to be strongly typed)?
2) If so, do I need to know these column names/types when I am designing the report or is there a way to dynamically create?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梅窗月明清似水 2024-10-13 09:17:24

如果您正在做客户端报告(rdlc),那么我建议编写一个类来保存该行的数据,并将报告的数据源(我相信是report.LocalReport.DataSource)绑定到该类型的集合。您可以创建数据集(您可以将数据表放入其中),但是,在我看来,这会搞乱项目,而且我不关心它。我知道您正在寻找逐步的答案,希望有人能给您答案,但希望我的回答能让您稍微改变方向。

如果您谈论的是服务器端报告 (rdl),那么您需要稍微重新考虑一下,因为服务器端报告的是 PULL 数据,它们没有推送数据。

哈特哈,
布莱恩

If you're doing a client side report (rdlc), then I would recommend writing a class that holds that data for a row, and binding the datasource (report.LocalReport.DataSource I believe) of the report to a collection of that type. You can do datasets (which you could put your data table in), but, in my opinion, that mucks up a project and I don't care for it. I know you're looking for a step-by-step answer, and hopefully someone will give you one, but hopefully my response will get you to change direction a bit.

If you're talking about a server side report (rdl), then you'll need to redo your thinking a bit, as server side reports PULL data, they do not have data pushed onto them.

HTH,
Brian

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文