cancel
Showing results for 
Search instead for 
Did you mean: 

when running my crystal report with the web ReportViewer I get a database logon failed message.

0 Kudos

Running crystal reports 16. Report created runs fine stand alone. But when I try to open it with web report viewer i get the database logon failed message. I am using same credentials from the report viewer as in the stand alon version.

Also, if I save the report with the connection in tact the report will run in the viewer but changing the datasource does not seem to change the reports access.

DellSC
Active Contributor
0 Kudos

Based on your question, I'm assuming that "web report viewer" means that you've written an application using the .NET SDK to view reports on the web, so I changed the tag on your question to "SAP Crystal Reports, version for Visual Studio". If you're using the Java SDK or you're trying to view reports through another application, please let me know.

The "SAP Crystal Reports" tag is for questions about report design and how to use the Crystal Reports desktop software.

The "SAP Crystal Reports viewer" tag is for questions about the stand-alone report viewer desktop app that you can download from SAP.

-Dell

DellSC
Active Contributor
0 Kudos

Can you please post the code that you're using to set the database credentials in your application? If you have subreports, are you explicitly setting the connection for the subreports or justs the main report?

-Dell

0 Kudos

Basically I am trying to change the datasource/ServerName location to point to the new location of the database. The old location in the report does not exist any more and I want my code behind to be able to change the server location to the new DEV environment and will need to do the same for the PROD environment.

The report accesses only one table in the database and there are no sub-reports.

ReportDocument rptDoc = new ReportDocument();

BOPSdatacommand bopsDC = new BOPSdatacommand();

try

{

//rptDoc.Load(Server.MapPath(rpt));

rptDoc.Load(ConfigurationManager.AppSettings["rptpath"] + rpt);

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

rptConn.ServerName = bopsDC.DataSource;

rptConn.DatabaseName = bopsDC.InitialCatalog;

rptConn.UserID = bopsDC.UserID;

rptConn.Password = bopsDC.Password;

rptConn.Type = ConnectionInfoType.SQL;

rptConn.IntegratedSecurity = false;

//rptDoc.SetDatabaseLogon(bopsDC.UserID, bopsDC.Password, bopsDC.DataSource, bopsDC.InitialCatalog);

//rptDoc.DataSourceConnections[0].SetConnection(bopsDC.UserID, bopsDC.Password, bopsDC.DataSource, bopsDC.InitialCatalog);

foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in rptDoc.Database.Tables)

{

TableLogOnInfo logon = tbl.LogOnInfo;

logon.ConnectionInfo = rptConn;

tbl.ApplyLogOnInfo(logon);

}

CrystalReportViewer1.ReportSource = rptDoc;

0 Kudos

When I use the below code and set EnableDatabaseLogonPrompt="true" I notice that the original data source properties popup on the logon screen, even though when I check my code properites the new data source values are included. The report seems to ignore the code behind changes.

rptDoc.Load(ConfigurationManager.AppSettings["rptpath"] + rpt);

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

rptConn.ServerName = bopsDC.DataSource;

rptConn.DatabaseName = bopsDC.InitialCatalog;

rptConn.UserID = bopsDC.UserID;

rptConn.Password = bopsDC.Password;

rptDoc.DataSourceConnections[0].SetConnection(bopsDC.DataSource, bopsDC.InitialCatalog, bopsDC.UserID, bopsDC.Password);

foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in rptDoc.Database.Tables)

{

TableLogOnInfo logon = tbl.LogOnInfo;

logon.ReportName = rptDoc.Name;

logon.ConnectionInfo = rptConn;

logon.TableName = tbl.Name;

tbl.ApplyLogOnInfo(logon);

tbl.Location = tbl.Name;

}

CrystalReportViewer1.ReportSource = rptDoc;

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

As noted in the title of the download, if you are using VS 2022 then yes use that one, if not use the other one.

SP 9 would not be MS SQL 11 client aware so you need to update the Reports so you can use the newer client.

Answers (3)

Answers (3)

0 Kudos

What is the old Data source?

SQLNCLI11

What is the new Datasource?

SQLNCLI11

How are you connecting, ODBC, OLE DB, etc.?

OLE DB(ADO)

In a test report I am able to connect fine when I use the OLD connection and password, but when I want to change the connection to another connection which has the same password it still uses the old connection. Unless the password was not set on the old connection then the new connection attempt fails and it seems because it is trying to use the old connection that is not set with password.

0 Kudos

SAP Crystal Reports 2016 SP09 Patch 500 32 bit,

will there be issues if I install

  • VS 2022 - SP 32 and higher - NEW - 64 bit installer for VS 2022 only

because it is the 64 bit version, since I currently am using CR 2016 SP09 Patch 500 32 bit version?

Rick

0 Kudos

Hi Rick,

What SP are you using?

Try the latest SP 32 from here, if you are using CR for VS. If you are using BOE/CRS/CRSE .NET runtime you need to down laod it from the Support Site

CR for VS is here:

https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

What is the old Data source?

What is the new Datasource?

How are you connecting, ODBC, OLE DB, etc.?

You may need to use ReplaceConnection() API to update the connection info, search for it, there's multiple posts and KBA's on how to use the API.

Don