views:

1061

answers:

1

How can I change the data source (database server, username, password) that a Crystal report uses at runtime, running within a crystal server?

I have a crystal server and have uploaded reports that have a set datasource (SQL Server 2005 hosted on SERVER A, userA, passwordA). I would like to schedule reports to run using a different datasource (SQL Server 2005 hosted on SERVER B, userB, passwordB) from the c# client I've written.

The c# client can schedule reports to run within the server using objects provided by the crystal webservices. I've been using the following 3 objects:

BIPlatform
InfoObject
CrystalReport

Documentation on these objects can be found HERE

A: 

You should try to get some info about the ConnectionInfo Class


CrystalDecisions.Shared.ConnectionInfo myConnectionInfo = 
                 new CrystalDecisions.Shared.ConnectionInfo();

myConnectionInfo.DatabaseName = "Database";
myConnectionInfo.UserID = "Username";
myConnectionInfo.Password = "P@ssword";

Programmatically Change a Crystal Reports datasource location - in VB but you can use one of the online translation tools to convert from VB to C#:

http://www.developerfusion.com/tools/convert/vb-to-csharp/ http://www.carlosag.net/Tools/CodeTranslator/
http://converter.telerik.com/

Robert Vuković
The ConnectionInfo class is not exposed by the crystal web service. It's a class contained in the assembly CrystalDecisions.Shared.dll. I need a solution that uses the web service objects because I believe this is the only way I can interact with the reports as they are hosted on a Crystal Web Server.
argyle