To set subreport logon information

Parent Previous Next

 

Report Application Server .NET SDK Developer Guide

To set subreport logon information


 







You can change the user name and password to a subreport, or set its database to a different location, using the ReportClientDocument class. It lets you retrieve the database object for a subreport, which contains tables from one or more databases. Using this object, you can change the subreport logon information.

  1. Get the subreport database by using the GetSubreportDatabase method of the SubreportController object.

Visual Basic

Dim database As Database = rcd.SubreportController.GetSubreportDatabase(subreportName)

C#

Database database = rcd.SubreportController.GetSubreportDatabase(subreportName);

  1. Get a database table.

This sample gets the first database table.

Visual Basic

Dim table As ISCRTable = database.Tables(0)

C#

ISCRTable table = database.Tables[0];

  1. Create a copy of the table by calling the Clone method.

Visual Basic

Dim newTable As ISCRTable = table.Clone(False)

C#

ISCRTable newTable = table.Clone(false);

  1. Set the logon properties of the table.

Visual Basic

newTable.ConnectionInfo.UserName = "username"
newTable.ConnectionInfo.Password = "password"

C#

newTable.ConnectionInfo.UserName = "username";
newTable.ConnectionInfo.Password = "password";

  1. Set the table location for the subreport by replacing the original table with the new table that contains the logon information.

Visual Basic

rcd.SubreportController.SetTableLocation(subreportName, table, newTable)

C#

rcd.SubreportController.SetTableLocation(subreportName, table, newTable);

Visual Basic

Private Sub SubreportLogon(ByVal rcd As ISCDReportClientDocument, ByVal subreportName As String)
 
 Dim database As Database = rcd.SubreportController.GetSubreportDatabase(subreportName)
 Dim table As ISCRTable = database.Tables(0)
 Dim newTable As ISCRTable = table.Clone(False)
 newTable.ConnectionInfo.UserName = "username"
 newTable.ConnectionInfo.Password = "password"
 rcd.SubreportController.SetTableLocation(subreportName, table, newTable)
End Sub

C#

private void SubreportLogon(ISCDReportClientDocument rcd, string subreportName)
{
 Database database = rcd.SubreportController.GetSubreportDatabase(subreportName);
 ISCRTable table = database.Tables[0];
 ISCRTable newTable = table.Clone(false);
 newTable.ConnectionInfo.UserName = "username";
 newTable.ConnectionInfo.Password = "password";
        
 rcd.SubreportController.SetTableLocation(subreportName, table, newTable);
}

This list includes the namespaces used by the sample code:

© 2021 SAP AG. All rights reserved.

http://www.sap.com/sapbusinessobjects/

Support services

http://service.sap.com/bosap-support/

Created with the Personal Edition of HelpNDoc: Free Web Help generator