corelibraries-devexpress-dot-dataaccess-dot-connectionparameters.md
Serves as the base for classes that contain the parameters of data connections.
Namespace : DevExpress.DataAccess.ConnectionParameters
Assembly : DevExpress.DataAccess.v25.2.dll
NuGet Package : DevExpress.DataAccess
public abstract class DataConnectionParametersBase :
IConnectionPage
Public MustInherit Class DataConnectionParametersBase
Implements IConnectionPage
The following members return DataConnectionParametersBase objects:
Show 16 links
The DataConnectionParametersBase descendants contain settings used to specify connection parameters for the SqlDataSource.
Different DataConnectionParametersBase descendants provide connection parameters for different DBMS and data file formats. For instance, you can use the MsSqlConnectionParameters, OracleConnectionParameters, XmlFileConnectionParameters and many others.
To specify connection parameters for the specified SqlDataSource, create the required DataConnectionParametersBase descendant, specify its settings and assign the resulting DataConnectionParametersBase object to the SqlDataSource.ConnectionParameters property.
This example demonstrates how to customize connection settings before the DashboardViewer connects to a database using the DashboardViewer.ConfigureDataConnection event.
In this example, the dashboard’s XML definition contains a path to the secured Microsoft Access database. To visualize data from this database file, it is necessary to provide connection parameters; in particular, a user name and password for authentication. The DashboardViewer.ConfigureDataConnection event is used for this purpose. Its Access97ConnectionParameters.UserName and FileConnectionParametersBase.Password parameters are used to provide the user name and password respectively.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/winforms-dashboard-customize-connection-settings-before-connecting-to-database
using DevExpress.DataAccess.ConnectionParameters;
using DevExpress.DashboardCommon;
using DevExpress.XtraEditors;
namespace Dashboard_ConfigureDataConnection {
public partial class Form1 : XtraForm {
public Form1() {
InitializeComponent();
// Loads a dashboard from an XML file.
dashboardViewer1.LoadDashboard(@"..\..\Data\nwindDashboard.xml");
}
// Handles the ConfigureDataConnection event.
private void dashboardViewer1_ConfigureDataConnection(object sender,
DashboardConfigureDataConnectionEventArgs e) {
// Checks the name of the connection for which the event has been raised.
if (e.DataSourceName == "SQL Data Source 1") {
// Gets the connection parameters used to establish a connection to the database.
Access97ConnectionParameters parameters =
(Access97ConnectionParameters)e.ConnectionParameters;
// Specifies the user name used to access the database file.
parameters.UserName = "Admin";
// Specifies the password used to access the database file.
parameters.Password = "password";
}
}
}
}
Imports DevExpress.DataAccess.ConnectionParameters
Imports DevExpress.DashboardCommon
Imports DevExpress.XtraEditors
Namespace Dashboard_ConfigureDataConnection
Partial Public Class Form1
Inherits XtraForm
Public Sub New()
InitializeComponent()
' Loads a dashboard from an XML file.
dashboardViewer1.LoadDashboard("..\..\Data\nwindDashboard.xml")
End Sub
' Handles the ConfigureDataConnection event.
Private Sub dashboardViewer1_ConfigureDataConnection(ByVal sender As Object, _
ByVal e As DashboardConfigureDataConnectionEventArgs) _
Handles dashboardViewer1.ConfigureDataConnection
' Checks the name of the connection for which the event has been raised.
If e.DataSourceName = "SQL Data Source 1" Then
' Gets the connection parameters used to establish a connection to the database.
Dim parameters As Access97ConnectionParameters =
CType(e.ConnectionParameters, Access97ConnectionParameters)
' Specifies the user name used to access the database file.
parameters.UserName = "Admin"
' Specifies the password used to access the database file.
parameters.Password = "password"
End If
End Sub
End Class
End Namespace
Show 39 items
Object DataConnectionParametersBase AsaConnectionParameters
CustomStringConnectionParameters
MongoDBConnectionParametersBase
SqlServerConnectionParametersBase
AmazonRedshiftConnectionParameters
Access2007ConnectionParameters
MongoDBCustomConnectionParameters
ExcelDataSourceConnectionParameters
ExtractDataSourceConnectionParameters
ExtractDataSourceConnectionParametersBase
JsonSourceConnectionParameters
UpdateExtractDataSourceConnectionParameters
XpoDataSourceConnectionParameters
PervasiveSqlConnectionParameters
PostgreSqlConnectionParameters
See Also