This document describes how to provide a Web Report Designer with a set of default data sources available for all report design sessions.
To do this, create the data sources at runtime and add them to the ASPxReportDesigner.DataSources collection.
Online Example: How to integrate the Web Report Designer into a web application
Imports System Imports System.Web Imports DevExpress.DataAccess.ConnectionParameters Imports DevExpress.DataAccess.Sql ' ... Private Sub BindToData() ' Create a SQL data source with the specified connection parameters. Dim connectionParameters As New Access97ConnectionParameters(HttpRuntime.AppDomainAppPath & "App_Data\nwind.mdb", "", "") Dim ds As New SqlDataSource(connectionParameters) ' Create a custom SQL query to access the Products data table. Dim query As New CustomSqlQuery() query.Name = "Products" query.Sql = "SELECT * FROM Products" ds.Queries.Add(query) ds.RebuildResultSchema() ' Add the created data source to the list of default data sources. ASPxReportDesigner1.DataSources.Add("Northwind", ds) End Sub
When an end-user adds one of the available data sources to a report, the data source object is cloned and its created copy is assigned to the XtraReportBase.DataSource property. This is required to properly serialize the data source settings along with the report layout data when the report is saved.
For related code samples, please refer to the following online examples.