开发者

Populate .Net report viewer control from data table returned from a web servive

开发者 https://www.devze.com 2023-01-29 19:15 出处:网络
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 altoget

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 a开发者_如何学Gos 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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号