Skip to main content

ValidateCustomSqlQueryEventArgs Class

Provides data for the SqlDataSource.ValidateCustomSqlQuery event.

Namespace: DevExpress.DataAccess

Assembly: DevExpress.DataAccess.v24.1.dll

NuGet Packages: DevExpress.DataAccess, DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap

Declaration

public class ValidateCustomSqlQueryEventArgs :
    EventArgs

Remarks

The SqlDataSource.ValidateCustomSqlQuery event is raised each time the custom SQL query (CustomSqlQuery), which is used to select data, needs to be validated. The SqlDataSource.ValidateCustomSqlQuery event is raised in the following cases.

The ValidateCustomSqlQueryEventArgs.CustomSqlQuery property returns the SQL query being validated. By default, a custom query used to obtain data from the SQL database should contain only SELECT statements. If the custom query contains not only SELECT statements or the query is specified incorrectly, the ValidateCustomSqlQueryEventArgs.Valid property is set to false. The ValidateCustomSqlQueryEventArgs.ExceptionMessage property returns the corresponding exception message.

If necessary, you can check the validity of the custom SQL query manually and override the value of the ValidateCustomSqlQueryEventArgs.Valid flag and corresponding ValidateCustomSqlQueryEventArgs.ExceptionMessage message. In you set the ValidateCustomSqlQueryEventArgs.Valid to false manually, the CustomQueryValidationException will be thrown.

Important

Note that the default validation is performed if the SqlDataSource.DisableCustomQueryValidation property is set to false.

Inheritance

Object
EventArgs
ValidateCustomSqlQueryEventArgs
See Also