Can I create an RDLC and bind a dataset at runtime without creating a dataset at design time?

Just wondering if it's possible to bind an RDLC table at runtime.

I created a report, put a table control, but the VS compiler says the dataset needs to be set.

But I wanted to load data into this table using a dataset created in C # code, not to create a dataset and a table adapter.

Is it possible?

+2


source to share


3 answers


You will need the Dummy dataset to report. You can fill it with load data at runtime.



+3


source


Yes it is possible. You can rebind data to the ReportViewer control. You can use any data you require as long as it matches the table name used in your RDLC file.

The code for this would look something like this in VB.NET:



  ReportViewer1.Reset()
  ReportViewer1.LocalReport.DataSources.Clear()
  ReportViewer1.LocalReport.LoadReportDefinition(ms)     'Reload your definition (RDLC)

  'Bind dataTables to the report viewer control (This is the 'dataset' it is asking about)
  ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("DATANAME", DATATABLE))

ReportViewer1.RefreshReport()

      

+3


source


Use Dummy DataSet or you can also use XSLT to report at runtime without a dataset at design time.

+2


source







All Articles