c# - Generate Report Using Report Viewer in asp.net -


i want display report in admin panel when select sales person dropdown list in page nothing displayed , display error here.

below code:

protected void btnviewreport_click(object sender, eventargs e) {     reportviewer1.processingmode = processingmode.local;     reportviewer1.localreport.reportpath = server.mappath("~/salesperson.rdlc");     dataset ds = getdata("select * customer_new salesperson in (select +     email registration name='" + ddsalesperson.selectedvalue.tostring() +      "')");     reportdatasource datasource = new reportdatasource("customer_new",ds.tables[0]);     reportviewer1.localreport.datasources.clear();     reportviewer1.localreport.datasources.add(datasource); } private dataset getdata(string query) {     string constring = configurationmanager.connectionstrings["constr"].connectionstring;     sqlcommand cmd = new sqlcommand(query);     using (sqlconnection con = new sqlconnection(constring))     {         using (sqldataadapter sda = new sqldataadapter())         {             cmd.connection = con;             sda.selectcommand = cmd;             using (dataset ds = new dataset())            {                   sda.fill(ds, "customer_new");                   return ds;             }         }     } } 

and following error :

a data source instance has not been supplied data source 'dataset1'.

that error means dataset "dataset1" has not recieved data. i'd take guess dataset "customer_new" doesn't exist, or if have 2 datasets, 1 of may or may not using. try:

reportdatasource datasource = new reportdatasource("dataset1",ds.tables[0]); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -