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

IDataSourceWizardConnectionStringsProvider Interface

If implemented, enables managing data connections used by the Data Source Wizard.

Namespace: DevExpress.DataAccess.Web

Assembly: DevExpress.DataAccess.v18.2.dll

Declaration

public interface IDataSourceWizardConnectionStringsProvider

Remarks

Some DevExpress web components (for instance, the ASP.NET Report Designer and Web Dashboard) provide the capability to connect to SQL databases using the Data Source Wizard. This wizard allows end-users to select one of the predefined data connections, connect to a corresponding database and select the required data. The IDataSourceWizardConnectionStringsProvider interface allows you to implement a provider of connection strings that will be displayed in the Data Source Wizard’ UI.

The topics below describe how to implement IDataSourceWizardConnectionStringsProvider for different components:

Note

Note that IDataSourceWizardConnectionStringsProvider can be used only for SQL data sources. To learn how to supply end-users with data from another data source types, refer to the following topics:

Example

This example shows how to implement a custom provider of connection strings by implementing the IDataSourceWizardConnectionStringsProvider interface.

using DevExpress.DataAccess.ConnectionParameters;
using DevExpress.DataAccess.Native;
using DevExpress.DataAccess.Web;
// ...

    public class MyDataSourceWizardConnectionStringsProvider : IDataSourceWizardConnectionStringsProvider
    {
        public Dictionary<string, string> GetConnectionDescriptions()
        {
            Dictionary<string, string> connections = new Dictionary<string, string>();

            // Customize the loaded connections list.  
            connections.Remove("LocalSqlServer");
            connections.Add("msAccessConnection", "MS Access Connection");
            connections.Add("msSqlConnection", "MS SQL Connection");
            return connections;
        }

        public DataConnectionParametersBase GetDataConnectionParameters(string name)
        {
            // Return custom connection parameters for the custom connection.
            if (name == "msAccessConnection")
            {
                return new Access97ConnectionParameters("|DataDirectory|nwind.mdb", "", "");
            }
            else if (name == "msSqlConnection")
            {
                return new MsSqlConnectionParameters("localhost", "Northwind", "", "", MsSqlAuthorizationType.Windows);
            }
            return AppConfigHelper.LoadConnectionParameters(name);
        }
    }
See Also