how to test RDL report and how to chage datasource at runtime

How to preview Microsoft report (rdlc) in the reportviewer cntrol in the winform if I am using a stored procedure to retreive the data. please notice that the stored procedure includes a parameter.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
This MSDN article gives a pretty thorough walk-through of creating reports in .NET:

In my case, I created a DataSource for my report, and then retrieved the data needed to populate the report using standard Datatables and such. I then filled my DataSource table(s) with that data, and then used this code to setup and show my report:

 With rvJobCost
                    Dim rds As New ReportDataSource("ReportData", jobs.Tables("Report"))
End With

In the code block above, the rds object is filled using the jobs.Tables("Report"), which was created from the datasource used when creating the report.

I have no idea if this is "best practice" or not, but hopefully some of the more knowledgeable .NET Experts will chime in with better ideas!
fmichailAuthor Commented:
Thanks Scott

The code that you provided is used in runtime, however, how to test the report duing design time (i.e. preview it).

I will read the link that you provided, and let you know, hopefully it has a good way to handle subreports programatically.
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You asked how to change the datasource at runtime, so I'm not sure what you mean by your last comment.

If you want to preview the report, just run the application from Visual Studio and view the report in your reportviewer (assuming you have one).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fmichailAuthor Commented:
Hi Scott,
Actually it is my mistake, I changed the description of my question (Before I got any answer).Your Answer, and the link is greatly appreciated. And now I know from you that the way to test thereport is always through running it in areport viewer. nks Scott
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.