steve gray 8/8/2011 9:09:30 PM

Dynamically changing the data source of a Crystal Report at run time

This is a copy of a post off of the Microsoft forums that I didn't want to lose.

 

I have the problem about change database name and server name runtime...

I use CR for VS.NET 2005 to make a simple report
Use OLEDB for SQL Server and write SQL Statement in COMMAND OBJECT..
(Error will not occur, if I choose link table, not manually write SQL Statement)
I found that i cannot change DBName and ServerName

I receive error when i call function
Report.Database.Table(i).ApplyLogOnInfo(NewLogOnInfo)
--------------------------------------------
Failed to load database information.
Details: The database DLL 'crdb_query.dll' could not be loaded.
Error in File C:\DOCUME~1\anop3\LOCALS~1\Temp\{68D71403-5484-4650-B960-D55DB2523564}.rpt:
Failed to load database information.
---------------------------------------------

Then, I write code in miss password for bring popup, "Select Database" Window, to show
I found that if I write SQL Statement,
The Combo box of ServerName and Database are disable
I can change only userID and Password

Then I found new function in CR For VS2005
Report.SetDatabaseLogon()
It isn't show error but it not work to bring data from new database

By the way, it correct if i change only userID and Password

So, I back to try with VS2003... It is OK....

I don't sure i found it have hotfix for this problem in Crystal Version 10 but not Fix For "Crystal Report for .NET 2005"....
How can I apply the fix?

Please Help me to find out what should i missing and
what should i do

I think it is the critical function because
When i develop i use Develop Server and
I need to change database to Production Server
and it can done in VS2003

Version: Unknown or N/A
Section: Crystal Reports


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3