Question

I am new to RDLC reporting, my requirement is simple. I have designed a report and i have set some parameters in that report to populate dynamic data.

Now i have requirement to display table dynamically as well. So what i did:

DataSet InvoiceSummaryDs = new DataSet();
                    DataTable table = new DataTable();
                    table.TableName = "summary";
                    table.Columns.Add( "name", typeof( string ) );
                    table.Rows.Add(Invoice.TotalBooking);
                    table.Rows.Add("£ " + Invoice.BillAmount);
                    table.Rows.Add("£ " + Invoice.BillAmount + "  <br />" + "£ " + Invoice.VatAmount);
                    table.Rows.Add("£ " + Invoice.NetAmount);

                    InvoiceSummaryDs.Tables.Add(table);

                    ReportDataSource rptDataSource = new ReportDataSource("DSPrice", InvoiceSummaryDs.Tables[0]);
                    rv.LocalReport.DataSources.Add(rptDataSource);

                    rv.LocalReport.SetParameters(parms);
                    rv.LocalReport.Refresh();

so there is no issue at server side code but i get error in report: Error 13 The dataset ‘DS_NAME’ refers to the data source “”, which does not exist.

Error 14 The tablix ‘Tablix1’ is in the report body but the report has no dataset. Data regions are not allowed in reports without datasets.

In rdlc file i created a dataset with same name "DSPrice" having no source because i want to populate data from server side dynamically not from here.

I have already seen this example:

http://www.gotreportviewer.com/ Generate RDLC dynamically - Table

in which dynamic table binding is possible thorugh dynamic report creation but i dont want to create dynamic report.

any one guide me what is the solution? any help would be appreciated.

Was it helpful?

Solution

Finally, i resolved this issue myself.

Short summary of my requirements: I wanted to bind dataset from code to my RDLC report table.

when i created table inside RDLC report it gave me above mentioned error to provide datasource for table and i got confused why? i need to set it from C# coding.

then i got to know RDLC report cant know if you are going to provide datasource from code unless you create dynamic report through coding and i did'nt want to create dynamic report.

Solution:

1) Create place holder dataset having same name that you want to pass from code 2) that dataset must have same columns and names 3) assign that dataset to table datasource inside your report 4) and use same name columns to pass from coding 5) in this way you wont get that error and you can easily pass dynamic dataset from code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top