cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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:

CS_Web_RDObjMod_DBLogon

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();

crDocument.Load(reportPath);

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;

table.ApplyLogOnInfo(tableLogOnInfo);

}

Many thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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|http://service.sap.com/~form/sapnet?_SHORTKEY=01100035870000712280&_OBJECT=011000358700000675322008E]

CR 2008 with Service Pack1 does not support Pervasive

[Please see full supported list here|http://service.sap.com/~form/sapnet?_SHORTKEY=01100035870000712280&_OBJECT=011000358700001596952008E]

Best regards

Falk

Former Member
0 Kudos

Hi Falk,

Many thanks for your prompt answer.

I can see that only Pervasive 8 and 2000 are fully supported with CR2008. The point is that I can perfectly create and see all the reports I make in CR2008 with the ODBC driver of Pervasive 10. The problem only arises when trying to modify the database server at run time.

Is there anything I can do to make this work??

Regards,

Manuel

0 Kudos

Hi Manuel,

Although our platforms does not say we support PVSW 10 we should have no problems with it. I just installed version 10 on my PC and added a report to a windows app and it worked just fine.

It may be an issue with the WEB server not having access to the PVSW client or DSN info.

Need more info:

Which version of PVSW are you using, Work Group or Server?

Is it installed on the WEBs server or on a separate PC?

If you create a simple windows app and add a report using the DEMODATA DSN and previewed, not through code but using the Preview tab in the .NET IDE does that work? Then test it in code using the same log on properties.

Can you modify your WEB app to prompt for log on info?

Do you have security enabled on PVSW or are you using no security? If not security are you passing in empty strings for the user name and password?

Thank you

Don

Former Member
0 Kudos

Hi Don,

I am using Pervasive SQL Server installed on the same PC as the web server.

There is not any problem in just viewing the Report using the ReportViewer. The error comes when trying to modify the database server for the Report at run time. I can perfectly open the report in VS2008 and preview a sample without any errors.

The security is disabled on the PVSW , but I still need to use Master as the UserID and empty password.

0 Kudos

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 www.sysinternals.com 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

Don

Answers (0)