Change Subreport Data Connection

To have the subreport data source connection the same as the Master Report use this function inside the subreport.

Inside the Subreport DataSourceDemanded Event use the following code:

Private Sub DSReport_DataSourceDemanded(ByVal sender As Object, ByVal e As System.EventArgs)
Dim SConnect as DataConnectionParametersBase
SConnect = GetSQLDataSourceConnection(dsreport,"sqldatasource1")
End Sub

 What this code is doing:

The GetSQLDataSourceConnection obtains the Master Report connection for the Master Report sqldatasource1.

The SetSQLDataSourceConnection sets the Sub Reports sqldatasource1 connection to the the Master Report sqldatasource1 connection.







Sunday, 30 December 2018 Posted in Subreports