Click here to Skip to main content
15,888,325 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Experts,

I have created .xsd file and data is showing in the preview.I took all the fields in .rpt file and passing two parameters. When I run my below code Reportviewer showing only Parameter values. How can I get data?

Please help me to this helpless!

ReportDocument reportCaseByAgency = new ReportDocument();
reportCaseByAgency.Load(Server.MapPath(@"~/Reports/RPT_CaseByAgency.rpt"));
reportCaseByAgency.FileName = Server.MapPath(@"~/Reports/RPT_CaseByAgency.rpt");
reportCaseByAgency.SetParameterValue("@QTR", num2);
reportCaseByAgency.SetParameterValue("@Year", year);
ReportViewer1.ReportSource = reportCaseByAgency;
//reportCaseByAgency.ReadRecords();
//ReportViewer1.RefreshReport();
//ReportViewer1.DataBind();

Thanks,
Shafik
Posted

1 solution

You are missing code to attach your data.

You should have a Data Source of some type, likely a DataSet that contains the information you want in the report. Then add it like this:

C#
reportCaseByAgency.SetDataSource(myDataSet);


before setting the ReportView1.ReportSource.
 
Share this answer
 
Comments
[no name] 9-Jun-15 17:08pm    
Thank You so much for your reply. TableAdapter with data already added ans as a bundle .xsd file. Why need again SetDataSource?
Kschuler 9-Jun-15 17:16pm    
I thought .xsd files only show the layout of your data. It shows what tables and columns you want. I didn't think it stored actual data. So you are saying the data is attached in like a wizard or in design mode?
[no name] 9-Jun-15 17:33pm    
Exactly Its like a wizard made the connection and if I wanna see the actual data from .xsd ... I can. Please advise.
Kschuler 10-Jun-15 8:41am    
I have no idea how to debug when you use the wizard, I'm not even sure that you can. My advice is to manually set the DataSource in the code.

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