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