Replace a database connection for report and all subreports

Is there is any kind of means to transform the datasource area for a record and also all of it is subreports without needing to open each of them by hand?

8
2022-06-07 14:30:49
Source Share
Answers: 4

Here is just how I set my links at runtime. I get the link details from a config area.

        #'SET REPORT CONNECTION INFO
        For i = 0 To rsource.ReportDocument.DataSourceConnections.Count - 1
            rsource.ReportDocument.DataSourceConnections(i).SetConnection(crystalServer, crystalDB, crystalUser, crystalPassword)
        Next

        For i = 0 To rsource.ReportDocument.Subreports.Count - 1
            For x = 0 To rsource.ReportDocument.Subreports(i).DataSourceConnections.Count - 1
                rsource.ReportDocument.OpenSubreport(rsource.ReportDocument.Subreports(i).Name).DataSourceConnections(x).SetConnection(crystalServer, crystalDB, crystalUser, crystalPassword)
            Next
        Next
6
2022-06-07 18:56:14
Source

@Unsliced I assume the trouble he is accessing is when you take a crystal record a person created versus an additional data source, and also you bring it up in Crystal Reports XI, you need to do a Change Datasource for each and every area, consisting of those in subreports. If you simply transform resource on the leading degree of the record, it usually mistakes. (I assume that is a well-known concern in Crystal Reports).

1
2022-06-07 15:04:21
Source

I'm presuming you are chatting about.rdl documents from Reporting Services? (If not, my solution could be incorrect)

They are primarily simply XML, so you can load every one of them in and also do an XPath question to get the node which contains the datasource and also upgrade it.

1
2022-06-07 14:46:14
Source

Linked below - records (at the very least in CR XI) share the major record is datasource - probably your record is currently set up to make sure that is not an alternative for you?

1
2022-06-07 14:45:18
Source