Skip to main content

DashboardConfigurator.ValidateCustomSqlQuery Event

Provides the capability to check the validity of the custom SQL query used to supply the dashboard with data.

Namespace: DevExpress.DashboardWeb

Assembly: DevExpress.Dashboard.v24.2.Web.dll

Declaration

public event ValidateDashboardCustomSqlQueryWebEventHandler ValidateCustomSqlQuery

Event Data

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

Property Description
ConnectionName
CustomSqlQuery Gets the custom SQL query that should be checked.
DashboardId Gets the identifier of the current dashboard.
DataSourceComponentName Gets or sets the component name of the data source for which the event was raised.
DataSourceName Gets or sets the name of the data source for which the event was raised.
ExceptionMessage Gets or sets the exception message returned after custom SQL query validation.
Valid Gets or sets whether the current custom SQL query is valid.

Remarks

Tip

For information on how to use the DashboardConfigurator‘s API, see the following topic: Server-Side API Overview.

The ValidateCustomSqlQuery event is raised each time the custom SQL query, which is used to supply the dashboard with data, needs to be validated. This is true if the DashboardSqlDataSource is used as a dashboard data source and the CustomSqlQuery is used to select data. Thus, the ValidateCustomSqlQuery event is raised on each request to the SQL database.

Use the ValidateDashboardCustomSqlQueryWebEventArgs.DataSourceName event parameter to obtain the component name of the data source for which the event was raised. The ValidateDashboardCustomSqlQueryWebEventArgs.CustomSqlQuery event parameter returns the checked SQL query.

By default, a custom query used to obtain data from the SQL database should contain only SELECT statements. If the custom query does not contain solely SELECT statements, or the query is specified incorrectly, the ValidateDashboardCustomSqlQueryWebEventArgs.Valid property is set to false. The ValidateDashboardCustomSqlQueryWebEventArgs.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 ValidateDashboardCustomSqlQueryWebEventArgs.Valid flag and corresponding ValidateDashboardCustomSqlQueryWebEventArgs.ExceptionMessage message.

Important

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

See Also