cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Failed to open the connection crytal reports in visual studio 2019 with Hana database

Willian2605
Discoverer
0 Kudos
335

Hello, I'm new to programming. I would like to create a tool that reads my Crystal Reports .rpt file and sends the result by email. However, when I try to read the .rpt file, the connection fails. I'm using VS 2019, C# language.
Crystal Reports 13 SP37

I have already used commands like

SetDatabaseLogon(sqluser, sqlpassword, sqlserver, company);

or 

foreach (IConnectionInfo info in rpt.DataSourceConnections)
{
 info.SetLogon(UserID, Password);
 info.SetConnection(ServerName, DatabaseName, false);
}

foreach (ReportDocument sub in rpt.Subreports)
{
 foreach (IConnectionInfo info in sub.DataSourceConnections)
 {
 info.SetLogon(UserID, Password);
 info.SetConnection(ServerName, DatabaseName, UserID, Password);
 }

and it doesn't work

 

Willian2605_1-1746153434120.png

 

 

Accepted Solutions (1)

Accepted Solutions (1)

DonWilliams
Active Contributor
0 Kudos

CR for VS doesn't come with the Hana database Client.

Often what you need to do is create a report in CR Designer first, the same step you use to connect to Hana you need to set the same values in VS.

Test the connection in CR first, then set the same values in your app.

Then open that report in VS and see if it connects.

Try this, In VS open your test report or create a new report and set the Database info:

DonWilliams_2-1746188156957.png

Then select ODBC, I believe Hana Client uses ODBC, I don't have it so I can't show you:

DonWilliams_3-1746188266701.png

If that works then you need to set the same values in code as the Hana client requires.

 

 

Willian2605
Discoverer
0 Kudos

Thank you, but the idea is to take the ready .rpt files that are in SAP B1 and run them on another machine at specific times using the service. The connection string is already set up within Crystal Reports.

Willian2605_0-1746191215162.png

I can open it the first time when it's saved, but when I try to refresh the report, a message appears.

Willian2605_0-1746191410252.png

 

 

DonWilliams
Active Contributor
0 Kudos
You must have the hana Client installed on any PC that's going to refresh. Likely what youa re seeing are reports with saved data...
Willian2605
Discoverer
0 Kudos
Hello, yes, the machine I’m connected to has the SAP B1 client installed.
DonWilliams
Active Contributor
0 Kudos
CR for vS doesn't come with the Hana Client Dll, if there is one so I added the Hana Tag to the post and see if one of the Hana Rep's looks at this post

Answers (0)