0

i want to add reporting runtime capabilities to my software and have decided to go with RDL and local report viewer (WinForms)

I have been reading several good HOW TOs (MSDN and gotreportviewer) and articles and i have successfully done the following:

Converted the latest scheme with XSD (http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition) and at runtime generated an rdl file that is shown in the repot viewer.

The problem is that because i am not using the Server and there isn’t any actual connection in the local mode since the dataset is delivered at runtime the data isn’t persistent.

i want to embed the data in such a way that the only thing required is the RDL (actually it is an RDLC since it is in local mode).

i have discovered that there is an XML embedded way:

[from:StockChartsRS2008R2.rdl]

<DataSet Name="AWDataSet">       <Query>         <DataSourceName>AdventureWorksOffline</DataSourceName>         <CommandText>&lt;Query&gt; &lt;ElementPath&gt;Root /Stock {@High (Float), @Low (Float), @Close (Float), @Open(Float), @StockPriceDate(Date)} &lt;/ElementPath&gt; &lt;XmlData&gt; &lt;Root&gt; &lt;Stock High="30.4113833868661" Low="29.9705661418443" Close="30.2016959908158" Open="30.2323120165209" StockPriceDate="2008-01-13T00:00:00"/&gt;

...

The problem is that when i use the local report viewer i need to regenerate the dataset From the embedded data- and i don’t know how to do that:

_reportViewer.LocalReport.DataSources.Add(new ReportDataSource(???))

if successful it assures me that both working with server mode and client my data will always be available and the report displayed

also is there is a better way than XML embedded to persist the data?

Thanks, mosh.

moshe
  • 37
  • 1
  • 9

1 Answers1

0

ReportDataSource has a constuctor that accepts datasource name and IEnumarable with data http://msdn.microsoft.com/en-us/library/dd461468(v=vs.100).aspx

Just pass any data and rdlc will render it. Have a look at the following questions:

Binding an rdlc report with a business object

Community
  • 1
  • 1
SuperCuke
  • 168
  • 6