asp.net - Data rows from database are not displayed in rdlc report -
this code`
protected void btncreatebill_click(object sender, eventargs e) { displayreport(); } private datatable totalinfodata() { try { // open sql connection sqlconnection sqlcon = new sqlconnection(@"data source=pratikpc;initial catalog=dbbilling2.0;integrated security=true"); sqlcon.open(); // create command sqlcommand sqlcomm = new sqlcommand(); sqlcomm.connection = sqlcon; sqlcomm.commandtype = commandtype.text; sqlcomm.commandtext = "select * tbltotalfee class='" + classdropdownlist.selecteditem.value + "'and studentid='" + studentnamedropdownlist.selecteditem.value+"'"; // create instance of northwind datasetxsd dataset1.tbltotalfeedatatable totalinfodata = new dataset1.tbltotalfeedatatable(); // set data commands sqldataadapter sqlda = new sqldataadapter(sqlcomm); sqlda.fill(totalinfodata); // fill data in northwinddataset object. return totalinfodata; } catch (exception ex) { throw new exception(ex.message); } } private void displayreport() { try { // clear data source reportingforprintingreportviewer.localreport.datasources.clear(); // set datasource report // first parameter - report dataset name // second parameter - datasource object i.e datatable reportingforprintingreportviewer.localreport.datasources.add(new reportdatasource("dataset1", totalinfodata())); // or set report path reportingforprintingreportviewer.localreport.reportpath = httpcontext.current.server.mappath("~/report.rdlc"); // refresh , display report reportingforprintingreportviewer.localreport.refresh(); } catch (exception ex) { throw new exception(ex.message); } }
why isn't output coming in report?? there rows in database has not been returned. report looks after operation. why aren't rows being displayed??
this dataset
try adding schema name before dataset name. like- schemaname_dataset1
.
reportingforprintingreportviewer.localreport.datasources.add(new reportdatasource("schemaname_dataset1", totalinfodata()));
Comments
Post a Comment