A newer version of this page is available. Switch to the current version.

ISnapControl.ValidateCustomSql Event

Allows validation of the custom SQL query created using the Data Source Wizard or the Query Builder.

Namespace: DevExpress.Snap.Core

Assembly: DevExpress.Snap.v19.1.Core.dll


event EventHandler<ValidateSqlEventArgs> ValidateCustomSql

Event Data

The ValidateCustomSql event's data class is ValidateSqlEventArgs. The following properties provide information specific to this event:

Property Description
ConnectionParameters Gets parameters used to establish a connection to the data source containing a custom SQL query.
Message Gets or sets the exception message displayed if validation fails.
Sql Gets the text of a custom SQL query being validated.
Valid Gets or sets whether or not the current SQL query is valid.


The ValidateCustomSql event occurs when the custom SQL query used to select data from the external data source needs validation, i.e. before rebuilding query schema or retrieving data.

The ValidateCustomSqlQueryEventArgs.CustomSqlQuery property returns the text of SQL query. You can determine whether the text is valid, using custom criteria, and set the ValidateCustomSqlQueryEventArgs.Valid to true to proceed with the text or false to cancel and display a message specified by the ValidateCustomSqlQueryEventArgs.ExceptionMessage property.


If the ValidateCustomSql event is not handled, a custom query used to obtain data from the SQL database should contain only SELECT statements.

See Also