Back to Devexpress

CustomStringConnectionParameters.ConnectionString Property

corelibraries-devexpress-dot-dataaccess-dot-connectionparameters-dot-customstringconnectionparameters.md

latest8.3 KB
Original Source

CustomStringConnectionParameters.ConnectionString Property

SECURITY-RELATED CONSIDERATIONS

Do not build or assign a connection string from untrusted input (such as user-entered text). Always validate connection parameters to mitigate CWE-15-related security risks.

Gets or sets a connection string.

Namespace : DevExpress.DataAccess.ConnectionParameters

Assembly : DevExpress.DataAccess.v25.2.dll

NuGet Package : DevExpress.DataAccess

Declaration

csharp
public string ConnectionString { get; set; }
vb
Public Property ConnectionString As String

Property Value

TypeDescription
String

A String that contains connection parameters.

|

Remarks

Use the ConnectionString property in the following cases:

  • To pass additional parameters which are not exposed by the appropriate DataConnectionParametersBase descendant.
  • To specify a connection string to a cube in an MS Analysis Services database.

To learn how to build connection strings for different data providers, see the following help topic: How To Create a Correct Connection String.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ConnectionString property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-dashboard-bind-to-sql-server-database-file/CS/BindToMsSqlDatabaseFileExample/Form1.cs#L28

csharp
CustomStringConnectionParameters connectionParameters = new CustomStringConnectionParameters();
connectionParameters.ConnectionString =
    @"XpoProvider=MSSqlServer;Data Source=(LocalDB)\MSSQLLocalDB;" +

wpf-dashboard-olap-data-provider/CS/WpfDashboard_OlapDataProvider/MainWindow.xaml.cs#L27

csharp
OlapConnectionParameters olapParams = new OlapConnectionParameters();
olapParams.ConnectionString = @"provider=MSOLAP;
                      data source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll;

asp-net-core-dashboard-register-data-sources/CS/WebDashboardDataSources/Configuration/OlapDataSourceConfigurator.cs#L19

csharp
OlapConnectionParameters olapParams = new OlapConnectionParameters();
olapParams.ConnectionString = "Provider=MSOLAP;Data Source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll;"
    + "Initial catalog=Adventure Works DW Standard Edition;Cube name=Adventure Works;Query Timeout=100;";

wpf-dashboard-how-to-bind-to-sql-database-file/CS/WpfDashboard_SqlDataSource/MainWindow.xaml.cs#L63

csharp
if (e.DataSourceName == "MySqlDataSource")
    parameters.ConnectionString =
        @"XpoProvider=MSSqlServer;Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\NWind.mdf;Integrated Security=True";

WebFormsDashboardConfigurator/CS/WebFormsDashboardConfigurator/Global.asax.cs#L39

csharp
OlapConnectionParameters olapParams = new OlapConnectionParameters();
olapParams.ConnectionString = "Provider=MSOLAP;Data Source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll;"
    + "Initial catalog=Adventure Works DW Standard Edition;Cube name=Adventure Works;Query Timeout=100;";

winforms-dashboard-bind-to-sql-server-database-file/VB/BindToMsSqlDatabaseFileExample/Form1.vb#L30

vb
Dim connectionParameters As New CustomStringConnectionParameters()
connectionParameters.ConnectionString = "XpoProvider=MSSqlServer;Data Source=(LocalDB)\MSSQLLocalDB;" & "AttachDbFilename=|DataDirectory|\NW19.mdf;" & "Integrated Security=True"
Dim sqlDataSource As New DashboardSqlDataSource("NW19 SQL Server Database File", connectionParameters)

wpf-dashboard-olap-data-provider/VB/WpfDashboard_OlapDataProvider/MainWindow.xaml.vb#L24

vb
Dim olapParams As OlapConnectionParameters = New OlapConnectionParameters()
olapParams.ConnectionString = "provider=MSOLAP;
                      data source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll;

wpf-dashboard-how-to-bind-to-sql-database-file/VB/WpfDashboard_SqlDataSource/MainWindow.xaml.vb#L53

vb
Dim parameters As CustomStringConnectionParameters = TryCast(e.ConnectionParameters, CustomStringConnectionParameters)
    If Equals(e.DataSourceName, "MySqlDataSource") Then parameters.ConnectionString = "XpoProvider=MSSqlServer;Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\NWind.mdf;Integrated Security=True"
End Sub

WebFormsDashboardConfigurator/VB/WebFormsDashboardConfigurator/Global.asax.vb#L41

vb
Dim olapParams As New OlapConnectionParameters()
olapParams.ConnectionString = "Provider=MSOLAP;Data Source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll;" & "Initial catalog=Adventure Works DW Standard Edition;Cube name=Adventure Works;Query Timeout=100;"
e.ConnectionParameters = olapParams

asp-net-web-forms-dashboard-register-data-sources/VB/WebFormsDashboardDataSources/Pages/OlapDashboard.aspx.vb#L30

vb
Dim olapParams As OlapConnectionParameters = New OlapConnectionParameters()
olapParams.ConnectionString = "Provider=MSOLAP;Data Source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll;" & "Initial catalog=Adventure Works DW Standard Edition;Cube name=Adventure Works;Query Timeout=100;"
e.ConnectionParameters = olapParams

See Also

CustomStringConnectionParameters Class

CustomStringConnectionParameters Members

DevExpress.DataAccess.ConnectionParameters Namespace