Okay that is very simple. Don't be frustrated. I guide you step by step. Please Follow it:
1. Create a project.
2. Add DataSet and Name it DataSet1.
3. In the TestDataSet.xsd file Click Right Mouse Button and add TableAdapter.In this case you need to put the correct connection string of your database and select "Use Sql Statement" and in the editor you put your Query here. You might also use the Query Builder to generate your Query.Then Just Click Next and proceed . When you finish this step you will get a DataTable and Method "Fill,GetData()" something like this.
Is it Okay. We have finished to design our DataSet right? In this DataSet you might send parameter or You might use your Object DataSource .I am not going with that now.I just give you the simple solution Okay.
Now see the AdapterName on the DataSet that you create earlier. In my case this is TestTableAdapter.
Now Select the Adapter Portion on the DataSet then On the property window set its Modifier is Public.This is very important.
Now Write a function like,
public static DataSet1.EmployeeDataTable GetReportData()
{
DataSet1TableAdapters.EmployeeTableAdapter ta = new DataSet1TableAdapters.EmployeeTableAdapter();
return ta.GetData();
}
Here,
DataSet1.EmployeeDataTable-> DataSet1is my Dataset which is a namespace and EmployeeDataTableis my table name
DataSet1TableAdapters.EmployeeTableAdapter-> DataSet1TableAdapters is the adapter Container and EmployeeTableAdapter is my adapter.
That's fine Now we have also Data. This function returns the DataSet1.EmployeeDataTable so we might see our data in in this table. Got it right?
Now write another function to display the report
public void DisplayReport(DataSet1.EmployeeDataTable dt)
{
try
{
if (dt != null)
{
DataSource RDS=new DataSource();
reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local;
reportViewer1.LocalReport.ReportPath = "C:\\Users\\RASHIM\\Documents\\Visual Studio 2008\\Projects\\SSRS Test\\SSRS Test\\Report1.rdlc";
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1_Employee", dt));
reportViewer1.DocumentMapCollapsed = true;
reportViewer1.RefreshReport();
}
}
catch (Exception oEx)
{
MessageBox.Show(oEx + "ShowReport");
}
}
Here,
reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1_Employee", dt));
DataSet1-> Dataset Name and Employee->Table name
That's all. Now When you call this Function with valid parameter your report will display. I hide lots of thing I guess you might do it by your own way. But main Two functions i am giving here.
If you are unable to display the report Please lemme know i will help you from my level best