Skip to main content
You are viewing help content for a version that is no longer maintained/updated.
All docs
V21.2
  • .NET Framework 4.5.2+
    • The page you are viewing does not exist in the .NET Standard 2.0+ platform documentation. This link will take you to the parent topic of the current section.

    SnapDocumentServer.ValidateCustomSql Event

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

    Namespace: DevExpress.Snap

    Assembly: DevExpress.Docs.v21.2.dll

    NuGet Package: DevExpress.Document.Processor

    Declaration

    public 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 end-user enters custom SQL query text using the Data Source Wizard or the Query Builder, if the SnapControl.Options.DataSourceWizardOptions.SqlWizardSettings.EnableCustomSql property is set to true.

    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 (default validation criterion).

    See Also