winforms - how to bind datasource to a .rdlc report in c# -
friends , have developed simple application using c# , has 2 rdlc reports
i used below code bind datasource report viewer
this.reportviewer1.localreport.reportpath = @"c:\documents , settings\administrator\my documents\visual studio 2008\projects\reports\reports\report1.rdlc"; reportviewer1.localreport.datasources.clear(); reportviewer1.localreport.datasources.add(new reportdatasource("customer", dt.tables[0])) ; this.reportviewer1.refreshreport();
but when report generated ,it empty report no data displayed , opinion???
when add .rdlc report in project wizard default take dataset name 'dataset1' . if want bind dynamically new dataset name of dataset must 'dataset1'. try change , check table[0] contains data(rows) datatype matched original datatype of dataset1
. if datatype doesn't matches data wont come in reportviewer. try code:-
string exefolder = (path.getdirectoryname(application.startuppath)).substring(0, (path.getdirectoryname(application.startuppath)).length - 3); string reportpath = path.combine(exefolder, @"reports\sessionreport.rdlc"); microsoft.reporting.winforms.reportdatasource rds = new microsoft.reporting.winforms.reportdatasource("dataset1", yourdataset.tables[0]); this.reportviewer1.localreport.datasources.add(rds); this.reportviewer1.localreport.reportpath = reportpath; this.reportviewer1.refreshreport();
for more detail .rdlc report(core logic) refer following link how create report (rdlc) without database?
Comments
Post a Comment