Skip to main content
All docs
V24.2

Customize Data Connections in the Data Source Wizard (WinForms)

  • 2 minutes to read

This topic describes how you can specify data connections displayed in the list of available connections when the user adds a new data source.

Data Source Wizard Custom Connections

Implement a Connection Storage

When a user adds a new data source, the list of available connections in the Data Source Wizard is populated with connections defined in the application configuration file.

You can use a custom storage to load and save the Data Source Wizard connections. For this, create a class that implements the IConnectionStorageService interface. The GetConnections method should return a collection of all available connections. You can decide in code whether to include connections defined in the application configuration file. The SaveConnection method should save connection information to a storage (the connectons.xml file in this example).

View Example: WinForms End-User Report Designer - How to Store Connections Available in the Data Source Wizard

Important

In this example, the connection string in the XML file is not encrypted and exposes sensitive information (a username and a password). You should protect the file storage to prevent unauthorized access in a real-world application.

Hide Connection Parameters in Saved Reports

When a user saves a report in the Report Designer, the resulting file contains complete connection information, including username and password. For security reasons, you may wish to hide connection parameters from users and not save sensitive information in report files, so that the REPX file contains only the connection name.

To apply security restrictions, create a connection storage for the End-User Report Designer and register a service that resolves a connection name to a valid connection string when the user loads a report for preview, print, or export.

Do the following:

The sample code is shown in the following example:

View Example: Reporting for WinForms - How to Enable the Report Designer to Save Only Connection Name with Reports and Exclude Connection Parameters