Hello, I'm currently working with a program that using the reportviewer in VS 2012. I have been looking online since yesterday, trying to find any kind of tutorial on how to switch between reports. I have this so far, but it doesn't work. I have another snippet I've been trying to work with, and it too is having issues. This code directly below doesn't throw any errors, the set after it does.
//i don't use these blocks of code at the same time... this.reportViewer1.LocalReport.DataSources.Clear(); DataTable dt = new DataTable(); dt = this.DataTable1TableAdapter.GetData(); string name = "DataSet1"; // this must exist in the RDLC file Microsoft.Reporting.WinForms.ReportDataSource rprtDTSource = new Microsoft.Reporting.WinForms.ReportDataSource(name, dt); this.reportViewer1.LocalReport.DataSources.Add(rprtDTSource); this.reportViewer1.RefreshReport(); //2nd set of code i've been trying Microsoft.Reporting.WinForms.ReportDataSource rds = new Microsoft.Reporting.WinForms.ReportDataSource(); rds.Name = databaseDataTable.TableName; rds.Value = myDataTable; reportViewer1.LocalReport.ReportPath = "Report2.rdlc"; reportViewer1.LocalReport.DataSources.Clear(); reportViewer1.LocalReport.DataSources.Add(rds); reportViewer1.RefreshReport();