SqlWizardSettings.EnableCustomSql Property

Specifies whether or not the Data Source wizard and Query Builder allow end-users to create and execute custom SQL queries.

Namespace: DevExpress.DataAccess.UI.Wizard

Assembly: DevExpress.DataAccess.v20.2.dll


public bool EnableCustomSql { get; set; }
Public Property EnableCustomSql As Boolean

Property Value

Type Default Description


true, to allow end-users to use custom SQL queries; otherwise, false.

Property Paths

You can access this nested property as listed below:

Library Object Type Path to EnableCustomSql
Cross-Platform Class Library DataSourceWizardSettings
WinForms Controls DataSourceWizardOptions
Reporting XRDesignMdiController
Dashboard DashboardDesigner


When the EnableCustomSql property is disabled at the level of a specific control, custom SQL cannot be entered and executed in the Data Source Wizard of this control.

If the EnableCustomSql is set to true, the Data Source wizard allows end-users to specify the custom SQL query on the Create a Query or Select a Stored Procedure (Single-Query Version) page.



The End-User Report Designer provides another version of this wizard page. To learn more, see Create a Query or Select a Stored Procedure (Multi-Query Version).

When running the Query Builder, it displays the Allow Edit SQL check box that also enables end-users to specify the custom SQL query manually.


If the static SqlDataSource.AllowCustomSqlQueries property is also set to true (which is the default value), the application is allowed to execute custom queries (e.g., in a Print Preview of an End-User Report Designer).

By default, a valid query can only contain SELECT statements. To enable custom queries containing DELETE, INSERT, PROCEDURE and UPDATE statements, set the static SqlDataSource.DisableCustomQueryValidation property to true.


Unrestricted execution of custom queries enables end-users to voluntarily modify a connected database. Avoid enabling this option unless you are absolutely certain about the expected results.

To provide custom query validation logic, handle the SqlDataSource.ValidateCustomSqlQueryGlobal event or similar events of the corresponding control. For example:

See Also