Web Database Application Specialists

CDS Banded Report Writer

Installation and Use

Click here to download the zip file for the Banded Report Writer (Note that the trial version limits the number of records displayed to 50)

Zip file contents:

  CDS_BandedReport.DLL DLL for the banded report writer  
  Run_CDS_BandedReport.aspx Web page to call to run a report  
  Web.Config Configuration file for ASP.Net  
  HTM/Customers.HTM Sample template  
  HTM/CDS_BandedReport.css Sample CSS file  
  Customers.asp Sample ASP program to run a report  
  Customers.aspx Sample ASPX program to run a report  
  InstallationVerification.htm Web page to run several Web pages to insure proper installation  

Installation Instructions

  1 Unzip the installation zip file to a temporary directory
  2 Create a new folder for the application in the WWWRoot folder
  1 Copy the files in the temp folder as follows:
  1. Copy the contents of “CDSWeb” folder to the application directory
  2. Copy the contents of “CDSWebBin” to the “top level” WWWRoot\bin directory
  4 Modify the Web config file to point to the sample Northwind database (change the "OLEDBConnectionString" string as appropriate - note that "PROVIDER=SQLOLEDB" is required).  The current setting is:

<appSettings>
  <add key="OLEDBConnectionString" value="PROVIDER=SQLOLEDB;server=(Local);uid=sa;pwd=;database=Northwind;" />
</appSettings>

  5 Open the InstallationVerification.htm web page and open the various programs to test the installation (if you have any problems, click here for some installation tips)
  6 Once the test application works, copy the "Run_CDS_BandedReport.aspx" file to your application directory and modify the web.config file as specified in Step 4 above.

Session/Request variables used by the report writer

ConnectionStringField Specifies the the <appSettings> variable in Web.Config which has the connection string for the database (using a variable name allow the developer to use an existing <appSettings> variable instead of setting up a new one)
FileName Name of the HTML template
FilePath Directory where the HTML Template is located
Sql SQL or stored procedure with data to report
MaxRecords Maximum number of records to include on the report (blank =all)
TotalsOnly If = "ON", detail records will not be included
SubTitle Subtitle for the report
   

ASP Code to run a report:

  Dim redirect
redirect = "Run_CDS_BandedReport.aspx"
'---------- Variables that control the report execution
redirect = redirect & "?ConnectionStringField=OLEDBConnectionString" '
redirect = redirect & "&FileName=Customers.htm"
redirect = redirect & "&FilePath=htm" 
redirect = redirect & "&Sql=Select * from customers order by companyname"   
redirect = redirect & "&MaxRecords="  
redirect = redirect & "&TotalsOnly=" 
redirect = redirect & "&SubTitle="
'----------------- Variables to print on the report - name included in {{..}}
redirect = redirect & "&Address=Name-Address-CSZ" ' (html template contains {{Address}})
Response.Redirect redirect

ASPX Code to run a report  - use the above or the following:

  Session("ConnectionStringField")="OLEDBConnectionString"
Session("FileName")="
Customers.htm"
Session("FilePath")="htm"
Session("Sql")="
Select * from customers order by companyname"
Session("MaxRecords")=""
Session("TotalsOnly")=""
Session("SubTitle")=""
Session("Address")="Name-Address-CSZ"
Response.Redirect ("Run_CDS_BandedReport.aspx")

ASPX Code to run a report  imbedded in an ASPX page

In the Visual Studio project, add a reference to "CDS_BandedReport.DLL" (in the WWWRoot/bin directory)

On the Web page, add a label such as

          <asp:Label id="lblReport"  runat="server"></asp:Label>

In the "Code behind" page, "declare" the function in the dll: (in the "Page_Load" subroutine)

           Dim BandedReport As New CDS_BandedReport.CDS_BandedReport

Then set up the session variables:

  Session("ConnectionStringField")="OLEDBConnectionString"
Session("FileName")="Customers.htm"  ' Just the tags between <body> and </body>
Session("FilePath")="htm"
Session("Sql")="Select * from customers order by companyname"
Session("MaxRecords")=""
Session("TotalsOnly")=""
Session("SubTitle")=""

Then save the report to the Web page:

         lblReport.Text = BandedReport.BandedReport()