Enable Custom SQL in Report Designer

This tutorial demonstrates how to enable custom SQL editing in the Data Source Wizard of the End-User Report Designer for Windows Forms.

Important

For security reasons, enabling custom SQL editing is not recommended if your reporting application can be accessed by untrusted parties. Refer to the Data Access Security document for more information.

Do the following to enable custom SQL editing by your end-users:

  1. Select the Report Designer's XRDesignMdiController in the component tray.

    winforms-report-designer-select-mdi-controller-bars

  2. In the Properties window, expand the XRDesignMdiController.SqlWizardSettings complex property and set the SqlWizardSettings.EnableCustomSql property to true.

    winforms-report-designer-enable-custom-sql

  3. Custom SQL editing is now enabled. To view the result, run your reporting application, invoke the embedded Data Source Wizard and go through wizard pages until the query creation page.

    On this page, click the report-wizard-multi-query-page-icon-add button for the Queries category to create a new query using the Query Builder.

    report-wizard-invoke-query-builder

    The Allow Edit SQL option is now available in the Query Builder. Switching to this mode disables the visual features of the Query Builder in favor of the specified SQL string value.

    eud-query-builder-custom-sql

    If you use an older Data Source Wizard version, you can specify a custom SQL on the query customization page.

    data-source-wizard-create-query

Important

Custom SQL queries are validated before their execution.

Although the default validation mechanism only allows custom queries containing SELECT statements (except for SELECT INTO clauses), it cannot be considered safe as it does not prevent execution of potentially harmful requests.

For this reason, we strongly recommend that you implement your own validation logic that permits only execution of specific query kinds.

To learn more, see the Provide Custom Query Validation in Report Designer document.

See Also