Click here to Skip to main content
15,074,483 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello All

I am using reportwizard for reports.
i am using MicrosoftReportViewer to show these reports.
i want to choose report to show in reportviewer at runtime.
for this i am using following code :

private void Report_Load(object sender, EventArgs e)
            LocalReport lr = reportViewer1.LocalReport;
            lr.ReportPath = AppDomain.CurrentDomain.BaseDirectory+"..\\..\\Reports\\rptSaleHotel.rdlc";
            SqlDataAdapter adp = new SqlDataAdapter("HotelSale", ConfigurationManager.ConnectionStrings["cn"].ConnectionString);
            adp.SelectCommand.CommandType = CommandType.StoredProcedure;
            adp.SelectCommand.Parameters.Add("@to", SqlDbType.DateTime).Value = "02-17-2011";
            DataSet ds = new DataSet();
            ReportDataSource rds = new ReportDataSource();
            rds.Value = ds.Tables[0];
            rds.Name = "salehotel";
            string st=lr.ReportPath.ToString();

but it is showing totally blank report and a message
A datasource instance has not been supplied for the datasource 'dbTraDeskDatase_HotelSale'.i have checked the value in dataset it contain 6 records.

can anyone please tell me where i am wrong

thanks in advance
Updated 13-May-20 23:54pm
Member 10957757 14-May-20 5:56am
thank you so much bro. your code very helpfull

i got the answer.
i was wrong at
rds.Name = "salehotel";
here i have to give
rds.Name = "dbTraDeskDataSet_HotelSale";
i.e. the name of datasource.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900