Skip to main content

DashboardControl.AsyncValidateCustomSqlQuery Event

Enables you to check the validity of the custom SQL query used to supply the dashboard with data.

Namespace: DevExpress.DashboardWpf

Assembly: DevExpress.Dashboard.v24.1.Wpf.dll

NuGet Package: DevExpress.Wpf.Dashboard

Declaration

public event ValidateDashboardCustomSqlQueryEventHandler AsyncValidateCustomSqlQuery

Event Data

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

Property Description
ConnectionName Gets the name of the connection to the data source containing a custom SQL query.
ConnectionParameters Gets parameters used to establish a connection to the data source containing a custom SQL query.
CustomSqlQuery Gets the custom SQL query that should be checked.
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

The AsyncValidateCustomSqlQuery event is raised if the following conditions are met:

The DashboardControl fires the AsyncValidateCustomSqlQuery event for each custom SQL query in the following situations:

Use the ValidateDashboardCustomSqlQueryEventArgs.ConnectionName/ValidateDashboardCustomSqlQueryEventArgs.ConnectionParameters properties to obtain the details of the connection to the SQL database. The ValidateDashboardCustomSqlQueryEventArgs.DataSourceComponentName event parameter returns the component name of the data source for which the event was raised.

The ValidateDashboardCustomSqlQueryEventArgs.CustomSqlQuery event parameter contains a query to validate.

If the SqlDataSource.DisableCustomQueryValidation property is set to false, a custom query is validated internally before raising the AsyncValidateCustomSqlQuery event, in particular, it should contain only SELECT statements. If the custom query contains not only SELECT statements, or the query is considered incorrect, the ValidateDashboardCustomSqlQueryEventArgs.Valid property is false and the ValidateDashboardCustomSqlQueryEventArgs.ExceptionMessage property contains a message describing the situation.

You can check the validity of the custom SQL query manually. Set the ValidateDashboardCustomSqlQueryEventArgs.Valid value and specify the message text using the ValidateDashboardCustomSqlQueryEventArgs.ExceptionMessage property.

Important

This asynchronous event is raised in a thread different from the main UI thread, so the event handler should not contain the code that accesses controls and other objects created in UI thread.

See Also