Skip to main content
A newer version of this page is available. .

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

NuGet Packages: DevExpress.DataAccess, DevExpress.WindowsDesktop.DataAccess

Declaration

[DefaultValue(false)]
public bool EnableCustomSql { get; set; }

Property Value

Type Default Description
Boolean **false**

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
.SqlWizardSettings .EnableCustomSql
WinForms Controls DataSourceWizardOptions
.SqlWizardSettings .EnableCustomSql
Reporting XRDesignMdiController
.SqlWizardSettings .EnableCustomSql
Dashboard DashboardDesigner
.DataSourceWizardSettings .EnableCustomSql
DashboardDesignerDataSourceWizardSettings
.SqlWizardSettings .EnableCustomSql

Remarks

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.

data-source-wizard-custom-sql

Note

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.

DataBinding_QueryDesigner_SQLViewCut

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.

Important

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