views:

1433

answers:

3

Hi guys

Just wondering if it's possible to databind a RDLC's table at run time.

I've created a report, put a table control, but VS compiler says it's necessary to set a dataset.

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

Is it possible?

thank you

+1  A: 

You need a Dummy Data Set for the report. You can fill it with you load data on runtime.

Goows
+1  A: 

Yes it is possible. You can rebind the datatable on the ReportViewer control. You can use any datatable you want, as long as it matches up with the Tablename used in your RDLC file.

Code to do 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()
Jon
A: 

Use Dummy DataSet or You can also use XSLT for runtime report without dataset at design time.

Prityalok