1216292 - How do you change the path to an Access database using the RAS SDK?

SAP Knowledge Base Article - Public

1216292 - How do you change the path to an Access database using the RAS SDK?

Symptom

 

A Microsoft Visual Studio .NET (VS .NET) application uses the Report Application Server (RAS) SDK as the reporting development tool.

 

How do you change the location of the database at runtime using the RAS SDK?

 

 

Environment

Crystal Reports for Visual Studio

Resolution

 

To change the location of the database at runtime use the following code:

 

'Import statements above your class

 

Imports CrystalDecisions.ReportAppServer.ClientDoc

 

Imports CrystalDecisions.ReportAppServer.DataDefModel

 

Imports CrystalDecisions.ReportAppServer.ReportDefModel

 

Dim ClientDoc As New ReportClientDocument

 

Dim logonPb New as CrystalDecisions.ReportAppServer.DatadefModel.PropertyBag()

 

Dim table_Old as New as CrystalDecisions.ReportAppServer.DatadefModel.Table()

 

Dim table_New as New as CrystalDecisions.ReportAppServer.DatadefModel.Table()

 

'Open the report object to initialize the ReportClientDocument

 

ClientDoc.Open "C:\myfolder\myReport.rpt"

 

table_old = clientDoc.Database.Tables(0)

 

'Clone the original table in the report

 

table_new = table_old.Clone(true)

 

' Get the connection information from the report document for the first table in the collection.

 

logonPb = table_new.ConnectionInfo.Attributes("QE_LogonProperties")

 

logonPb.Item("Database Name") = "C:\myFolder\myDatabase.mdb"

 

' Set a new table for the report, set the old table to the new one.

 

clientDoc.DatabaseController.SetTableLocation table_old, table_new

 

'view the report

 

CrystalReportViewer1.ReportSource = ClientDoc

 

====================

NOTE:

 

The report connects using a native connection (crdb_dao.dll) to an Access database. The report is then moved to another computer where the database location is different.

 

====================

 

Keywords

ACCESS NATIVE RAS9 RAS 9 DATABASE CHANGE LOCATION SETTABLELOCATION PATH Crystal Enterprise Report Application Server Development Database Issues Set Location , c2013777 , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem

Product

SAP Crystal Reports 9.0