Workbook.ValidateCustomSqlQuery Event
Allows you to validate a custom SQL query created in the Data Source Wizard.
You need a license for the DevExpress Office File API Subscription or DevExpress Universal Subscription to use this event in production code.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Docs.v24.1.dll
NuGet Package: DevExpress.Document.Processor
Declaration
Event Data
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. |
Remarks
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 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).