c# - How do i use linq as datasource for a Microsoft report -
var exams = (from appointment in appointments select new {coursecode = (appointment.tag exam).id}).tolist(); rpt.localreport.datasources.add(new reportdatasource("dsexam". exams.asenumerable())); rpt.processingmode = processingmode.local; rpt.refreshreport();
each appointment object contains exam object. use results of linq query datasource of report. first row in ienumerable exams shown in report though contains 81 rows. how can fix this.
var exams = (from appointment in appointments select new { ((exam)appointment.customfields["field"]).id, ((exam)appointment.customfields["field"]).name, ((exam)appointment.customfields["field"]).date, ((exam)appointment.customfields["field"]).period.starttime, ((exam)appointment.customfields["field"]).period.endtime, location = ((exam)appointment.customfields["field"]).location.name }); setdatasource(exams); private void setdatasource(object exams) { schedulebindingsource.datasource = exams; this.rpttviewer.processingmode = microsoft.reporting.winforms.processingmode.local; this.rpttviewer.refreshreport(); }
Comments
Post a Comment