1326008 - How to pass database logon parameters to a Crystal Report Published via a Web Service

SAP Knowledge Base Article - Public

1326008 - How to pass database logon parameters to a Crystal Report Published via a Web Service

Symptom

Reports published via a Web Service prompt users for a database login

Resolution

  • Use the Crystal Reports .NET viewer database logon APIs as describe below.
  • Note that the database logon information is case sentitive!
Dim crTableLogonInfos As TableLogOnInfos
Dim crTableLogonInfo As TableLogOnInfo
Dim crConnectionInfo As ConnectionInfo
'' Create a new instance of the tablelogoninfos class which contains
''the tablelogoninfo objects for each table in the report
crTableLogonInfos = New TableLogOnInfos()
''Create a new instance of the TableLogonInfo class which contains
''the connection information for each table
crTableLogonInfo = New TableLogOnInfo()
''Set the connection properties
''Note: this sample report connects to the SQL Server sample Pubs database
''If you have access to SQL server, enter in your values for the ServerName,
''UserID and Password properties to connect. The report included with this
''sample application connects using OLE-DB and SQL authentication.
crConnectionInfo = New ConnectionInfo()
With crConnectionInfo
.ServerName = "Server1"
.DatabaseName = "Pubs"
.UserID = "myuser"
.Password = "mypassword"
End With
''apply the connection information to each table. If the TableName is not specified, the 
''logon to the database will fail. Once the tablename and connection information have been
''set for each table object, it is added to the TableLogonInfos collection using the Add method.
crTableLogonInfo.ConnectionInfo = crConnectionInfo
crTableLogonInfo.TableName = "authors"
crTableLogonInfos.Add(crTableLogonInfo)
''Pass the table information to the logoninfo property of the viewer
CrystalReportViewer1.LogOnInfo = crTableLogonInfos

Keywords

KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

Product

Crystal Reports 2008 V1