Skip to Content
avatar image
Former Member

Problem changing Database server at runtime: ApplyLogOnInfo() not working

Hi all,

I am using CR2008 v12.0.0.683 with VS2008 v9.0.21022.8 RTM.

Crystal Reports 2008 for Visual Studio. Windows XP SP3.

I am developing a Web application that uses a PervasiveSQL v10.01 database.

I have used exactly the same code used in the sample provided for Visual Studio:


Unfortunately, right after the execution of table.ApplyLogOnInfo(tableLogOnInfo), the values of the TableLogOnInfo go back to the values stored on the original report, and worst of all, I got the error:

"Failed to open the connection"

The report I am currently using is a very simple one I have just created to simplify the problem. It lists just one table without any subreports or parameters. The table listed exists in both databases I want to test, the original set on the report and the one I want the report to collect the information from.

Any idea about why the method ApplyLogOnInfo is not working?

protected void Page_Load(object sender, EventArgs e)


string reportName = Request.QueryString\"reportName\";

string reportPath = ConfigurationManager.AppSettings.Get("CrystalReportsDefaultFolder") + reportName;

ReportDocument crDocument = new ReportDocument();


string dbuser = "dbuser";

string dbpass = "dbPass";

string dbserver = "dbserver";

string dbname = "dbname";

setConnectionDatabaseString(crDocument, dbserver, dbname, dbuser, dbpass);

crystalReportViewer.ReportSource = crDocument;


public void setConnectionDatabaseString(ReportDocument document, string server, string database, string user, string password)


ConnectionInfo connectionInfo = new ConnectionInfo();

connectionInfo.ServerName = server;

connectionInfo.DatabaseName = database;

connectionInfo.UserID = user;

connectionInfo.Password = password;

Tables tables = document.Database.Tables;

foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)


TableLogOnInfo tableLogOnInfo = table.LogOnInfo;

tableLogOnInfo.ConnectionInfo = connectionInfo;



Many thanks in advance!

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Sep 24, 2008 at 08:20 AM

    Hello Manuel,

    I was checking the database support for Pervasive databases

    following the information I found :

    CR 2008 no Service Pack supports

    Pervasive SQL 2000 with dataconnector ODBC Pervasive 2000,Pervasive SQL Client 2000

    and Pervasive SQL 8 with dataconnector ODBC Pervasive 8

    [Plese see the full supported list here|]

    CR 2008 with Service Pack1 does not support Pervasive

    [Please see full supported list here|]

    Best regards


    Add comment
    10|10000 characters needed characters exceeded

    • Hi Manuel,

      Thank you for the info. Can you check the WEB server and verify the \PVSW\Bin folder is in the PATH statement. Possibly the WEB server can't or does not have access to the client engine, Or CR does not have access through the WEB connector.

      Is the client engine running as a Process or a Service? Try running it under the same account the web service is running under. Or create a new local account that has Admin rights and run WEB and your app under that same user account.

      If you view a report with saved data and then enable the refresh button does it prompt you for log on info?

      I don't need to use Master as the user name, mine is simply set up as the default install settings. Try removing the Master from the account info in code and retest. By default there should not be any user assigned to the PVSW database, are you sure you are using no security? Try creating a report of the Pervasive DEMODATA and see if that works without entering in a user name.

      If you have Crystal Report Designer 2008 Developer version you will have a our Native Btrieve driver installed. If so, create a new report and select Btrieve as the data source. Point to the file.ddf and add a table and field and run that.

      As a Test run the Pervasive Control Center and verify the user info.

      Next test is to remove Crystal from the picture. Create a new WEB app and use the .NET Database features. Add the database and see if you can do some basic SQL, like select field from table and see if that works. If it doesn't it is definitely a security/permission issue.

      You can also run a tool called ProcessExplorer from or even simpler to use from our site a program called modules. You can then verify if the WEB server can load or has access to the Pervasive w3dbsmgr.exe process. If you don't see it in under the Web server executable then it's again because of access tights.

      Thanks again