Reporting Services using Entity Framework -
i had experience in developing reports(ssrs) using ado.net dataset. working on application not using ado.net entity framework entity framework not return datatable or dataset. want know
- is there way use collection or custom objects return entity framework in reporting services?
- entity framework somehow return datatable or dataset.
or should create datatable/dataset collection returned entity framework manually.
for record, getting resultset executing stored procedure entity framework.
public void getmyreportdata() { using (myentitydatamodel v = new myentitydatamodel()) { var reportquery = (from r in v.mytable select new { l.id, l.leaveapplicationdate, l.employeenumber, l.employeename, l.startdate, l.col1, l.col2, ......., ......., l.address }).tolist(); reportviewer1.localreport.datasources.clear(); reportdatasource datasource = new reportdatasource("nameofreportdataset", reportquery); reportviewer1.localreport.datasources.add(datasource); stream rpt = loadembededreportdefinition("report1.rdlc"); reportviewer1.localreport.loadreportdefinition(rpt); reportviewer1.refreshreport(); //another way of setting reportviewer report source string exefolder = path.getdirectoryname(application.executablepath); string reportpath = path.combine(exefolder, @"rdlcreports\report1.rdlc"); reportviewer1.localreport.reportpath = reportpath; reportparameter p = new reportparameter("deptid", deptid.tostring()); reportviewer1.localreport.setparameters(new[] { p }); } } public static stream loadembededreportdefinition(string reportname) { assembly _assembly = assembly.getexecutingassembly(); stream _reportstream = _assembly.getmanifestresourcestream("projectnamespace.rdlcreportsfolder." + reportname); return _reportstream; }
original source: creating reports in asp.net entity framework
Comments
Post a Comment