In my application I have one report viewer, but I have multiple reports. I need change the report as per the client input. For example
client click for Assets detail. I need to bind the AssetDetail.rdlc report at runtime. I have written a code for that, but it's not working.. I tried the code suggested in internet sources, but that is also not working. I have given my code below.
private void button1_Click(object sender, EventArgs e)
{
OleDbDataAdapter dataAdapter = new OleDbDataAdapter("SELECT Descriptn, AssetType, Location, Model, SerialNumber, Status, AssetCode, Dateofpurchase, WarrantyExpiry, Condition, Profile FROM Assets", con);
DataSet ds = new DataSet();
dataAdapter.Fill(ds);
ReportDataSource reportDataSource = new ReportDataSource();
this.reportViewer1.LocalReport.DataSources.Clear();
this.reportViewer1.LocalReport.ReportEmbeddedResource = "AssestsManagementSystem.ReportAssetList.rdlc";
this.reportViewer1.LocalReport.ReportPath = "ReportAssetList.rdlc";
reportDataSource.Value = ds.Tables[0];
reportDataSource.Name = "DataSet2";
this.reportViewer1.LocalReport.DataSources.Add(reportDataSource);
this.reportViewer1.Refresh();
}
Please help me with this.