Skip to main content
All docs
V21.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

SnapControl.ValidateCustomSql Event

Allows validation of the custom SQL query.

Namespace: DevExpress.Snap

Assembly: DevExpress.Snap.v21.2.dll

NuGet Package: DevExpress.Win.Snap

#Declaration

#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.

#Remarks

The ValidateCustomSql event occurs when the end-user enters custom SQL query text using the Data Source Wizard or the Query Builder, if the QueryBuilderEditQueryContext.EnableCustomSql property is set to true.

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

Note

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

#Implements

See Also