Skip to main content
All docs
V24.1

Manage Timeout Limit

  • 2 minutes to read

The Dashboard Designer has a 300-second time limit to execute a query. When a query timeout expires, the query execution stops and an exception occurs.

You can extend or shorten the time limit in code. The ConnectionOptions.DbCommandTimeout property specifies how many seconds the Dashboard Designer waits for a query to execute. The time set in the property is stored in a dashboard definition after a successful connection to a database.

The example below shows how to extend the timeout.

The created SetTimeout method sets the time limit up to 600 seconds for each SQL Data Source in the current Dashboard. When the DashboardDesigner.DashboardChanged and Dashboard.DataSourceCollectionChanged events occur, the SetTimeout is called.

using DevExpress.DashboardCommon;
using DevExpress.DataAccess.Sql;
using System;
using System.Windows.Forms;

namespace DesignerSample {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
            dashboardDesigner1.CreateRibbon();
            dashboardDesigner1.DashboardChanged += dashboardDesigner1_DashboardChanged;
        }
        private void dashboardDesigner1_DashboardChanged(object sender, EventArgs e) {
            SetTimeout();
            dashboardDesigner1.Dashboard.DataSourceCollectionChanged += Dashboard_DataSourceCollectionChanged;
        }

        void Dashboard_DataSourceCollectionChanged(object sender, DevExpress.DataAccess.NotifyingCollectionChangedEventArgs<IDashboardDataSource> e) {
            SetTimeout();
        }

        private void SetTimeout() {
            foreach(var dataSoure in dashboardDesigner1.Dashboard.DataSources) {
                if(dataSoure is SqlDataSource) {
                    (dataSoure as SqlDataSource).ConnectionOptions.CommandTimeout = 600;
                }
            }
        }

    }
}