ComponentOne VSView Reporting Edition
Application-defined Aliases

Another possible scenario is one where you want to allow certain users to see the reports, but you do not want to give them any special authorizations or information about where the data is stored.

There are two simple ways to achieve this with VSReport8. One is by using embedded reports. Load the report definition into your application at design time, using the Load Report property page, and the report will be embedded in the application. This way, you do not have to distribute a report definition file and no one will have access to the data source information.

The second way would be for your application to define a set of connection string aliases. The report definition file would contain the alias, and your application would replace it with the actual connection string before rendering the reports.The alias would be useless in any other applications (such as the VSReport8 Designer). Depending on how concerned you are with security, you could also perform checks on the RecordSource property to make sure no one is trying to get unauthorized access to certain tables or fields in the database.

The code below shows how you might implement a simple alias scheme:

Example Title
Copy Code
Private Sub RenderReport(strReportName $)

 

  ' load report requested by the user

  vsr.Load App.Path & "\MyReports.xml", strReportName

 

  ' replace connection string alias

  Dim strConn$

  Select Case vsr.DataSource.ConnectionString

 

    Case "CUSTOMERS"

    Case "EMPLOYEES"

       strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _

                "Data Source=C:\SecureData\People.mdb;" & _

                "Password=slekrsldksd;"

    Case "$$SALES"

      strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _

                "Data Source=C:\SecureData\Numbers.mdb;" & _

                "Password=slkkdmssids;"

  End Select

 

  ' render the report and clear it when done

  vsr.Render vp

  vsr.Clear

End Sub

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback