This is my code for trying to get just one report running (which just gives toolbar and spinning icon).
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult SSRS(ReportViewerParams param)
{
return new ReportViewerHtmlActionResult(this.GetSSRSModel(), param);
}
ReportViewerModel GetSSRSModel()
{
string projectId = "1"; //ViewData["ReportProjectId"].ToString();
ReportViewerModel reportModel = new ReportViewerModel();
reportModel.ReportPath = Request.PhysicalApplicationPath + "ReportViewer\\Project Schedule Report.rdlc";
//reportModel.ReportPath = Server.MapPath("~/ReportViewer/Project Schedule Report.rdlc");
reportModel.EnableVirtualEvaluation = false;
ReportDataSourceCollection dataSources = new ReportDataSourceCollection();
//create an sql connection using the default connection string
SqlConnection cn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Repository"].ConnectionString);
SqlCommand cmd = new SqlCommand("", cn);
SqlDataAdapter da = new SqlDataAdapter();
//Create the Projects DS
cmd.CommandText = "Select ProjectID, ProjectNumber + ' - ' + ProjectName as 'ProjectName' from Projects order by 2";
da.SelectCommand = cmd;
DataTable dsProjects = new DataTable("Projects");
da.Fill(dsProjects);
//this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Projects", dsProjects));
dataSources.Add(new ReportDataSource("Projects", dsProjects));
//END Projects DS
//Create the GeneralInformation DS
cmd.CommandText = @"Select P.ProjectNumber,
P.ProjectName,
u.FirstName + ' ' + u.LastName + ' ' + u.ContactNumber as 'ProjectManager',
c.CampusName,
p.ProjectDescription
from Projects p left join
Users u on p.projectmanagerid = u.userid left join
Campus c on p.campusid = c.campusid
where P.ProjectID = @ProjectID";
da.SelectCommand = cmd;
DataTable dsGeneralInformation = new DataTable("GeneralInformation");
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("@ProjectID", projectId);
da.Fill(dsGeneralInformation);
//this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("GeneralInformation", dsGeneralInformation));
dataSources.Add(new ReportDataSource("GeneralInformation", dsGeneralInformation));
//END GeneralInformation DS
//Create the Schedule DS
cmd.CommandText = @"SELECT [MilestoneName] as 'Milestone'
,[OriginalDate]
,[ProjectedDate]
,[ActualDate]
,'' as Comments
FROM [dbo].[ProjectMilestone]
Where ProjectID = @ProjectID and Flag = 1
union all
SELECT [OtherDateName] as 'Milestone'
,[OriginalDate]
,[ProjectedDate]
,[ActualDate]
,'' as Comments
FROM [dbo].[ProjectOtherDates]
Where ProjectID = @ProjectID and Flag = 1
order by OriginalDate";
da.SelectCommand = cmd;
DataTable dsSchedule = new DataTable("Schedule");
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("@ProjectID", projectId);
da.Fill(dsSchedule);
//this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Schedule", dsSchedule));
dataSources.Add(new ReportDataSource("Schedule", dsSchedule));
//END Schedule DS
reportModel.DataSources = dataSources;
return reportModel;
}