Skip to main content
You are viewing help content for a version that is no longer maintained/updated.
All docs
V21.2
  • ISnapControl.ValidateCustomSql Event

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

    Namespace: DevExpress.Snap.Core

    Assembly: DevExpress.Snap.v21.2.Core.dll

    NuGet Package: DevExpress.Snap.Core

    Declaration

    event EventHandler<ValidateSqlEventArgs> ValidateCustomSql

    Event Data

    The ValidateCustomSql event's data class is ValidateSqlEventArgs. The following properties provide information specific to this event:

    Property Description
    ConnectionParameters Gets parameters used to establish a connection to the data source containing a custom SQL query.
    Message Gets or sets the exception message displayed if validation 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 ValidateCustomSql event occurs when the custom SQL query used to select data from the external data source needs validation, i.e. before rebuilding query schema or retrieving data.

    The ValidateCustomSqlQueryEventArgs.CustomSqlQuery property returns the text of SQL query. You can determine whether the text is valid, using custom criteria, and set the ValidateCustomSqlQueryEventArgs.Valid to true to proceed with the text or false to cancel and display a message specified by the ValidateCustomSqlQueryEventArgs.ExceptionMessage property.

    Note

    If the ValidateCustomSql event is not handled, a custom query used to obtain data from the SQL database should contain only SELECT statements.

    See Also