private void btnConsultar_Click(object sender, EventArgs e) { ReportDataSource reportDataSource1 = new ReportDataSource(); //this.bindingSource1.DataSource = typeof(CursosEntities.Entities.Curso); reportDataSource1.Name = "DataSet1"; reportDataSource1.Value = this.bindingSource1; var viewer = new Reports.ReportViewer(); viewer.reportViewer1.LocalReport.DataSources.Add(reportDataSource1); viewer.reportViewer1.LocalReport.ReportEmbeddedResource = "Cursos.Presentation.Reports.Cursos.Cursos.rdlc"; try { //var query = from u in commB.GetList<Curso>() // select u; var query = commB.ReporteCursosDtos(); if (!string.IsNullOrEmpty(txtIdCurso.Text)) { query = query.Where(q => q.IdCurso == Convert.ToInt32(txtIdCurso.Text)); } if (!string.IsNullOrEmpty(txtIdProfesor.Text)) { query = query.Where(q => q.IdProfesor == Convert.ToInt32(txtIdProfesor.Text)); } if (!string.IsNullOrEmpty(txtIdEstudiante.Text)) { query = query.Where(q => q.IdEstudiante == Convert.ToInt32(txtIdEstudiante.Text)); } List <CursosDtos.ReporteCursosList> ls = query.ToList(); //foreach (var item in ls) //{ // Debug.WriteLine(item.NombreCurso); //} List <ReportParameter> paramList = new List <ReportParameter>(); string parameterNombre = commB.GetList <Parametro>().FirstOrDefault().Nombre; paramList.Add(new ReportParameter("pParametrosNombre", @parameterNombre)); viewer.reportViewer1.LocalReport.SetParameters(paramList); bindingSource1.DataSource = ls; viewer.ShowDialog(); viewer.reportViewer1.RefreshReport(); } catch (Exception ex) { General.LogInfo(ex, "Control", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }