The online documentation is incomplete and full of errors.The easiest way is simply to add a report to a your project from VS2005. It creates a .rdlc file. Then you can use the inline designer to build your report. I have not tried doing it from business objects (so far only inline sql statements and datasets), if you figure this out, please let me know. Many of my projects are built on Rocky Lhotka's CSLA.net.|||
I'd like to know how to create a report from ADO datasets. If you have code that works, please post here.
I have figured out how to do the business object report. Follow all of the instructions in this walkthrough:
http://msdn2.microsoft.com/en-us/library/ms251784#
However the last instruction for the form load of the report viewer form is wrong. You will need to replace the following:
this.ProductBindingSource.DataSource = m_merchant.GetProducts();
WITH:
|||reportViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local;
reportViewer.LocalReport.ReportPath = @."C:\<your path>\Report1.rdlc";
reportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("<your namespace>_Product", m_merchant.GetProducts()));
this.ProductBindingSource.DataSource = m_merchant.GetProducts()
This last instruction is not actually wrong. I thought the same thing since I did not understand where "ProductBindingSource" came from, but I later realized that it is the name of the Binding Source Instance.
In order to find this, open up the smart tags panel in the top right hand corner of the report viewer control, select "Choose Data Source" and there you will see the instance name for the appropriate data source. Simply replace "ProductBindingSource" in this.ProductBindingSource.DataSource = m_merchant.GetProducts() with the name of the instance.
No comments:
Post a Comment