Skip to main content
A newer version of this page is available. .

DashboardSqlDataSource Class

An SQL data source that provides data for the dashboard.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v18.2.Core.dll

Declaration

public class DashboardSqlDataSource :
    SqlDataSource,
    IDashboardDataSource,
    IDashboardComponent,
    IComponent,
    IDisposable,
    ISupportInitialize,
    ISupportPrefix,
    IDashboardDataSourceInternal

Remarks

Use the DashboardSqlDataSource class to create a data source that uses a connection to the SQL database. You can specify connection parameters and select the required data in the following way.

  1. Specify connection parameters to the SQL database. Create the DataConnectionParametersBase class descendant and specify the required properties.

    Then, assign the resulting object to the SqlDataSource.ConnectionParameters property.

    Note

    As an alternative, you can add a connection string with required parameters to the application configuration file. Then, assign the connection string name to the SqlDataSource.ConnectionName property.

  2. Select the required data by specifying the query. You can do this in the following ways.

    • The SelectQuery object allows you to specify a set of tables/columns, which forms a SELECT statement when executing a query.
    • The CustomSqlQuery object allows you to specify an SQL query manually.
    • The StoredProcQuery object allows you to perform a stored procedure call to supply the dashboard with data.

    Add the created query to the SqlDataSource.Queries collection exposed by the DashboardSqlDataSource object.

  3. Add the created DashboardSqlDataSource object to the Dashboard.DataSources collection.

Example

The following example shows how to bind a dashboard to an SQL database using DashboardSqlDataSource.

Dim access97Params As New Access97ConnectionParameters()
access97Params.FileName = "..\..\Data\nwind.mdb"

Dim sqlDataSource As New DashboardSqlDataSource("SQL Data Source 1", access97Params)
Dim selectQuery As SelectQuery = SelectQueryFluentBuilder.AddTable("SalesPerson"). _
    SelectColumns("CategoryName", "Sales Person", "OrderDate", "Extended Price").Build("Query 1")
sqlDataSource.Queries.Add(selectQuery)
sqlDataSource.Fill()

dashboardDesigner1.Dashboard.DataSources.Add(sqlDataSource)

Inheritance

Object
MarshalByRefObject
Component
DevExpress.DataAccess.DataComponentBase
SqlDataSource
DashboardSqlDataSource
See Also