corelibraries-devexpress-dot-dataaccess-dot-connectionparameters-dot-customstringconnectionparameters.md
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
public string ConnectionString { get; set; }
Public Property ConnectionString As String
| Type | Description |
|---|---|
| String |
A String that contains connection parameters.
|
Use the ConnectionString property in the following cases:
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
CustomStringConnectionParameters connectionParameters = new CustomStringConnectionParameters();
connectionParameters.ConnectionString =
@"XpoProvider=MSSqlServer;Data Source=(LocalDB)\MSSQLLocalDB;" +
wpf-dashboard-olap-data-provider/CS/WpfDashboard_OlapDataProvider/MainWindow.xaml.cs#L27
OlapConnectionParameters olapParams = new OlapConnectionParameters();
olapParams.ConnectionString = @"provider=MSOLAP;
data source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll;
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
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
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
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
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
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
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
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