.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
Row

Workbook.ValidateCustomSqlQuery Event

Allows you to validate a custom SQL query created in the Data Source Wizard.

You need an active 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.v20.1.dll

Declaration

public event SpreadsheetValidateCustomSqlQueryEventHandler ValidateCustomSqlQuery
Public Event ValidateCustomSqlQuery As SpreadsheetValidateCustomSqlQueryEventHandler

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

See Also