Looking at the Report Viewer Control
- Posted: Jan 02, 2006 at 12:30 PM
- 83,688 Views
- 8 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Right click “Save as…”
Microsoft Visual Studio 2005 includes a report designer functionality and a new set of ReportViewer controls that can be used to build and display reports within custom applications. Reports may contain
tabular, aggregated, and even multidimensional data. The ReportViewer controls are used to process and display these reports within applications. There are two versions of the controls. The ReportViewer Web server control is used to host reports in ASP.NET
projects. The ReportViewer Windows Forms control is used to host reports in Windows application processing.
Both controls can be configured to run in either local or remote processing mode. How you configure the processing mode effects everything about the reports from design to deployment.
In this Screencast Thom takes a look at how this control can be used to host both server reports and local reports
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
I this sample I saw that in Report Builder, reports designed were bound to models and in Visual Studio 2005 reports designed were bound to datasets/datatables. What came to my mind based on your sample is: Is it possible to have reports designed in Report Builder bound to datasets/datatables? Is it possible to have reports designed in Visual Studio 2005 bound to models?
datasets/datatables?
Sure - this is actually bound to a dataset by default. I would think that you could code this to bind to a datatable as well.
Is it possible to have reports designed in Visual Studio 2005 bound to models?
What kind of model do you mean?
Thanks....
I had a hard time understanding how to build the report since I could not add my xml file as a data source. What I did was added a new DataSet to my project and used it as my data source. This DataSet is not the actual DataSet I am using in code but they are identical in structure. This made designing the report easy.
After you add the Dataset to your project open up the xsd file that will be created and thne by right clicking in the Dataset Designer window navigate to Add>DataTable. This will add a blank DataTable Object to the designer window.
By right-clicking on the DataTable object you have the option of adding columns to it. Add columns to the DataTable exactly like they are in your DataSet that you have built in code. Also Make sure to rename the DataTable.
This newly created DataSet will now show up in the DataSource window and you can create your report file from it just like the video shows.
I used a report viewer and created a new report. When the report designer window opens there will be a new menu added to vs called 'Report' Clcik it and then click Data Sources. This opens up the Report Data Sources window. Make sure the Report Data Source listed matches the one you created, if not select it and delete it from the list then select your DataSet from the Project Data Sources dropdown and click 'Add to Report'
Now, tying it all together in your code is next.
After you have the Dataset in your app built and load in the data from the xml file (I won't demo that here, there are plenty of places to find out how to do it and it is very simple) I used this code to set the tie in my dataset I created in code to the report viewer.
Me.ReportViewer1.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("DataSet1_Bills", Me.MyBills.Tables("Bills")))
Me.ReportViewer1.RefreshReport()
DataSet1_Bills is what is listed in the Report Data Source window as discussed above. MyBills is the DataSet I created in code and I just reference the Bills table.
Hope this helps someone else out.
can we have a complete video here?
or is this the complete one.
Thanks for wonderful post. It helps me for creating rdlc report.
Now i need another help.
I need to add two tables/procedures in my report.
My report have two section. One is Header and another is details.
I sgall use companyInfo table for header and use TransactionInfo for detail section.
But i am unable to add two table of data Programmatically.
The report talke only one table with specific datasource name.
How i can load twho table at a time.
consider following code which i have used for retriveing single data table.
string sqlQ = "Select * from CompanyInfo";
string sqlQ1= @"Select * from command_1 where operationType = 2";
DataSet ds = new DataSet() ;
SqlConnection con = new SqlConnection("Data Source=ITSOFT206; initial catalog=rbrl;user id = sa;password=start777");
con.Open();
DataTable dt = new DataTable();
DataTable dt1 = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(sqlQ , con);
SqlDataAdapter da1 = new SqlDataAdapter(sqlQ1, con);
da.Fill(dt);
da1.Fill(dt1);
dt.TableName = "CompanyInfo";
dt1.TableName = "command_1";
ds.Tables.Add(dt.Copy ());
ds.Tables.Add(dt1.Copy());
da.Dispose();
da1.Dispose();
con.Close();
ReportViewer1.ProcessingMode = ProcessingMode.Local;
LocalReport lc = ReportViewer1.LocalReport;
lc.ReportPath = "Report1.rdlc";
ReportDataSource rds = new ReportDataSource();
rds.Name = "rptSource_command_1";
rds.Value = ds.Tables["command_1"];
lc.DataSources.Add (rds);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();
hope i will get solution.
unable to add a new dataset in reportviewer visual studio 2010.
I could do anything, from adding images, parameters and control to the designer; but as soon i try to ad a new dataset (using wizard also), my enviroment is forced to restart.
Note: Simple Windows Application with that one Report added.
Remove this comment
Remove this thread
close