hcurrie
9/15/2008 10:56:00 AM
> You're correct that the rdlc file is in xml format. But ReportViewer
> control is just a UI to display the report. It has no responsibility to
> know how the data is retrieved.
OK. Thanks. I just wondered as the LocalReport class was reading this file,
whether it is possible to access what it has loaded. If it just ignores the
sql, and doesn't provide any mechanism to access it, I guess I need to read
this separately myself.
>
> The logic how the report works is like this.
> 1. The ReportViewer control asks the ObjectDataSource for data.
> 2. The ObjectDataSource get data by calling the Select method defined in
> the Adapter class of the strongly typed DataSet. Then, ObjectDataSource
> pass data to the ReportViewer.
> 3. The ReportViewer check the rdlc to get the information as to what
> fields
> should be displayed and how to display them.
> 4. Then ReportViewer send the report back to the client.
I'm trying to eliminate step 2 once the report has been developed, so that
when I add a new report, I don't need to add any new code, just provide the
new rdlc file.
> So actually it's the Adapter class that is responsible for querying
> database. You can remove or change the SQL query in the rdlc file (open it
> with Notepad), it should still show the fields as normal.
> So in my opinion, the best option is to read the rdlc file directly (for
> example, using XmlReader, as you said). But the prerequisite is that you
> didn't change the SQL query stored in the rdlc file.
Once the report has been developed, I no longer need the the strongly typed
dataset and adapter. I plan to read the SQL from the rdlc file, and use this
with a generic Dataset object as the datasource.
I will have one project in which I will develop the reports, but when I want
to implement this in the main application, all I need to do is distribute
the rdlc file, as the generic code in the main application can get
everything it needs from there.