[Download Code] | [Run Sample] Sometimes you need to create reports quickly You might not always have time to format fancy reports containing graphs Or maybe you need to create a report that does not need graphs By reusing one ASP.... NET web page you can quickly make reports that are stored in XML files. The sample that is included in the download demonstrates how you can display up to three different database queries, using three DataGrids, on the same page. Each report is an XML file That Contains a Title for the Web Page and A Subtitle, Connection String, SQL SELECT Statement, And Page Size for Each Database Query.
EXAMPLE XML Report File:
XML Version = "1.0" encoding = "UTF-8"?>
Page>
Report>
Report>
Xmlreport>
The name of the report (XML file) is sent in the QueryString without the file extension (.xml) For example:. Reports.aspx report = reportname The XML report is loaded and the "Reports" table is iterated to bind data?. to the DataGrids. This would be a perfect place to use a control array, but ASP.NET does not support control arrays. The sample shows a way around this handicap.OleDb is used to connect to the data sources so you can use any OleDb . database Another neat feature is that each report has its own connection string This allows you to display reports from different databases on the same page Each report has a setting for page size;.. if left blank paging will not be enabled for that report.
The download is a complete working solution that I am currently using in-house. The download contains an Access database and a test report (Test.xml) that displays a product list and a summary. Now, when you want to create a report, just create an XML report file and save it in the reports directory. Then create a link to the reports.aspx page with your new file name (minus the extension) and your report is made. If you create many reports that do not require Graphs you will save much time..