Click here to Skip to main content
15,903,203 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
At first i got a data source instance has not been supplied for the data source 'dataset1' error. Pete O'Hanlon gave suggestion.

but now

mcs_kioskDataSet kds = new mcs_kioskDataSet();
      ReportDataSource rds = new ReportDataSource();
      rds.Value = kds;
      reportViewer1.ProcessingMode = ProcessingMode.Local;
      reportViewer1.LocalReport.ReportPath = @"D:\Jagadeeswaran\Project\User\User\Report2.rdlc";
      reportViewer1.RefreshReport();
      host.Child = reportViewer1;

I add Report1.rdlc as empty and Report2.rdlc as use of wizard. if i set the above code, the report is not enabled.

it throw an error

The report data source object must be of the type System.Data.DataTable, System.Collections.IEnumerable, System.Windows.Forms.BindingSource, or System.Type.

but when i switch to report1, in below code it show report.
reportViewer1.ProcessingMode = ProcessingMode.Local;
     reportViewer1.LocalReport.ReportPath = @"D:\Jagadeeswaran\Project\User\User\Report1.rdlc";
     reportViewer1.RefreshReport();
     host.Child = reportViewer1;


i think i am very near to my aim. help me.,

my dataset name is - mcs_kioskDataSet.xsd and my dataset object name is - kds.
Posted

1 solution

Instead of this:
rds.Value = kds;


try:
rds.Value = kds.Tables[0];


You need to give table as a source and not dataset.
 
Share this answer
 
Comments
Nish Nishant 8-Apr-11 10:12am    
Voted 5, proposed as answer!
Sagotharan Jagadeeswaran 9-Apr-11 0:37am    
thanks friend,.
but i already try this. if i put rds.Value = kds.Tables[0];

it throw the old error a data source instance has not been supplied for the data source 'dataset1' . what i do for that.
Sandeep Mewara 9-Apr-11 0:42am    
Well,
1. It has to be table.
2. Another error that you say sounds like because of reference of "dataset1" in your report which is not being supplied as the same name here. I would suggest you to look at various article here at CP itslef about report generation at runtime and see how it is done.
Sagotharan Jagadeeswaran 9-Apr-11 0:48am    
thank u very much,.

i do my best.
Sandeep Mewara 9-Apr-11 0:57am    
Thats the spirit.

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