windowsforms-devexpress-dot-xtraspreadsheet-dot-spreadsheetcontrol-5998854f.md
Allows validation of the custom SQL query created using the Data Source Wizard.
Namespace : DevExpress.XtraSpreadsheet
Assembly : DevExpress.XtraSpreadsheet.v25.2.dll
NuGet Package : DevExpress.Win.Spreadsheet
public event SpreadsheetValidateCustomSqlQueryEventHandler ValidateCustomSqlQuery
Public Event ValidateCustomSqlQuery As SpreadsheetValidateCustomSqlQueryEventHandler
The ValidateCustomSqlQuery event's data class is SpreadsheetValidateCustomSqlQueryEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| ExceptionMessage | Gets or sets the exception message displayed if validation of the custom SQL query 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 ValidateCustomSqlQuery event occurs when the end-user enters custom SQL query text using the Data Source Wizard if the SpreadsheetDataSourceWizardOptions.EnableCustomSql property is set to true.
The SpreadsheetValidateCustomSqlQueryEventArgs.Sql property returns the text of a SQL query. You can determine whether the text is valid, using custom criteria, and set the SpreadsheetValidateCustomSqlQueryEventArgs.Valid to true to proceed with the text or false to cancel and display a message specified by the SpreadsheetValidateCustomSqlQueryEventArgs.ExceptionMessage property.
Note
If the ValidateCustomSqlQuery event is not handled, a custom query used to obtain data from the SQL database should contain only SELECT statements (default validation criterion).
See Also