cancel
Showing results for 
Search instead for 
Did you mean: 

Changing data provider of a report when using the CrystalReportViewer

Former Member
0 Kudos

I'm trying to dynamically change the data source, connection information, and data provider of a Crystal Report at runtime.

I'm using Crystal v10, VB.NET 2.0, Visual Studio 2005, Pervasive 9.6

I began with a report configured using a btrieve/DDF connection and after a while I managed to get it running on the CrystalReportViewer with an ODBC connection. (Thanks to this forum, cheers!)

Now I'm trying to do this same task at runtime and it seems that no combination of ApplyLogOnInfo() trickery will do it. The loaded ReportDocument just refuses to take the changes and tries to open using it's original connection information and crashes.

I've used the ApplyLogOnInfo() Tutorial Sample successfully with SQL server, but Pervasive isn't having it.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Does [this|https://www.sdn.sap.com/irj/sdn/thread?threadID=969277&start=0] help?

Also, just to be on the same page, are you using this code to pass the connection information:

ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = "DSN Name"; // Name of the System dsn
connectionInfo.DatabaseName = "";
connectionInfo.UserID = "test";
connectionInfo.Password = "test";
connectionInfo.IntegratedSecurity = false;

Regards,

AG.

Former Member
0 Kudos

Yes.

This works only if the Report is already configured with an ODBC connection though. I'm trying to give it the different data provider at runtime which it doesn't seem to be able to do.

In Crystal, I can "Set Database Location" of the report and change it from a btrieve DDF connection, to an ODBC connection (Which is the exact same data except through a Pervasive DSN) without trouble, the report runs fine.

But when I try to do this programmatically, I get an "Unable to load database information" error Unable to load "crdb_p2bbtrv.dll"

This is the DLL I'm trying to get away from. If it doesn't like that one then fine, I'm trying to tell it to use a different one "crdb_odbc.dll" which if I "Set Database Location" in Crystal, it is happy to do.

Programmatically however, it seems to be a different story.

Former Member
0 Kudos

You may be out of luck on this one. How many reports do you have? You may have to permanently change the connection type to ODBC in the designer for them to work properly in your application.

It is possible to rip out and replace connection information using the in-process RAS SDK, but you'd need to upgrade to CRXI R2 to get this - it's not available with the 10.2 version of Crystal Reports. If you're going to do that, you could just stick with your Pervasive connection as per your other thread.

Former Member
0 Kudos

Thank you for confirming my suspicions.

I have abandoned the idea.

I believe I found a solution to my particular problem though. You can find it here:

Regards,

-Jack

Answers (0)