I am getting an exception from my C# Project while attempting to connect Crystal Report to the Hana Database. The Report was designed with CrystalReports 2011 SP6. From that environment, the report was successfully previewed. When trying to logon using the program, I am getting this exception.
CrystalDecisions.CrystalReports.Engine.LogOnException: Database logon failed. ---> System.Runtime.InteropServices.COMException: Database logon failed.
As demonstrated in many SAP tutorials, the System DSN is using for the connection.
DSN Name is : HANAODBC32
From the DSN, the connection is succeeding every time.
This is the code I added for Crystal Report
Me.rptDoc = New CrystalDecisions.CrystalReports.Engine.ReportDocument
Me.rptDoc.Load(sCRPath) ', OpenReportMethod.OpenReportByTempCopy)
Dim DatabaseUsername As String = "SYSTEM"
Dim DatabasePassword As String = "password"
ServerName = "HANAODBC32"
DatabaseName = "SBODEMOUS"
c = New ConnectionInfo
'Set Conenction info for DB
.ServerName = ServerName
.DatabaseName = DatabaseName
.UserID = DatabaseUsername
.Password = DatabasePassword
Me.rptDoc.SetDatabaseLogon(DatabaseUsername, DatabasePassword, ServerName, DatabaseName)
'Associate DB to the report
crDB = Me.rptDoc.Database
'Instantiate Tables collection
crTables = crDB.Tables
'Loop thru tables in report and set connection information
For Each crTable In Me.rptDoc.Database.Tables
TblLogonInfo = crTable.LogOnInfo
TblLogonInfo.ConnectionInfo = c
If Not crTable.Location.Contains(".") Then Continue For
crTable.Location = c.DatabaseName & ".dbo." & _
crTable.Location.Substring(crTable.Location.LastIndexOf(".") + 1)
Tried to change the Server name with actual server name. but at that time, another message is showing
Any help could be appreciated.
ODBC Driver Version is : 1.0000.52
Showing logon screen again and again when tried to Preview report from program.