Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: updating the Data source For Command Object Post Reply Post New Topic
Author Message
Mellison
Newbie
Newbie
Avatar

Joined: 20 Nov 2009
Location: India
Online Status: Offline
Posts: 15
Quote Mellison Replybullet Topic: updating the Data source For Command Object
    Posted: 19 Feb 2011 at 11:54pm

How to change the datasource of a Command Table (embedded SQL statement you add to Crystal) during runtime? My scenario is that I have a test database & a datasource called "test" set up where I used the "Add Command" to add TSQL that pulls the data into the report -
I now need to point the report to the live database called "Production". I have to set the Parameter Fields and tried updating the table location using datasoureController but it throws the following exception...

 
 
java.lang.ClassCastException
 at com.crystaldecisions.sdk.occa.report.data.Fields.add(Unknown Source)
 at com.crystaldecisions.sdk.occa.report.lib.ReportSDKVector.copyTo(Unknown Source)
 at com.crystaldecisions.sdk.occa.report.data.Procedure.copyTo(Unknown Source)
 at com.crystaldecisions.sdk.occa.report.data.CommandTable.copyTo(Unknown Source)
 at com.crystaldecisions.sdk.occa.report.data.CommandTable.clone(Unknown Source)
 at com.crystaldecisions.sdk.occa.report.application.ad.if(Unknown Source)
 at com.crystaldecisions.sdk.occa.report.application.DatabaseController.setTableLocation(Unknown Source)
 at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(Unknown Source)
 at com.crystaldecisions.sdk.occa.report.application.DatabaseController.setTableLocationEx(Unknown Source)
 at com.crystaldecisions.reports.sdk.DatabaseController.setTableLocationEx(Unknown Source)
 
Here is the sample code

            IProcedure procedure=(IProcedure) tables.getTable(i);
         ParameterFieldController paramFieldController=document.getDataDefController().getParameterFieldController();
            Fields params=procedure.getParameters();
            params.set(0, "142");
            params.set(1, "5.0");
            procedure.setParameters(params);
            procedure.setName(procedure.getName().toUpperCase());
            procedure.setAlias(procedure.getAlias());
            procedure.setQualifiedName(procedure.getName());
            procedure.setConnectionInfo(connectionInfo);
            databaseController.setTableLocationEx(procedure,tables.getTable(i));

   How should i do it?



Edited by Mellison - 19 Feb 2011 at 11:55pm
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.030 seconds.