Skip to main content

SpreadsheetControl.ValidateCustomSqlQuery Event

Allows validation of the custom SQL query created using the Data Source Wizard.

Namespace: DevExpress.XtraSpreadsheet

Assembly: DevExpress.XtraSpreadsheet.v24.1.dll

NuGet Package: DevExpress.Win.Spreadsheet

Declaration

public event SpreadsheetValidateCustomSqlQueryEventHandler ValidateCustomSqlQuery

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