Skip to main content
.NET Framework 4.5.2+

XpoDefault.ConnectionString Property

Gets or sets the string which is used to open a database, by default.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v23.1.dll

NuGet Package: DevExpress.Xpo


public static string ConnectionString { get; set; }

Property Value

Type Description

A String value which specifies the parameters needed to establish the initial connection.


Use the ConnectionString property to specify a connection string for the default Data Access Layer.

The default sessions and newly created sessions will use the specified connection string when they are connected to a data store, as shown in the following code example.

using DevExpress.Xpo;
using DevExpress.Xpo.DB;

// Retrieve the Microsoft Access database-specific connection string.
XpoDefault.ConnectionString =
    AccessConnectionProvider.GetConnectionString("sample.mdb", "user", "pwd");
// If the default session is connected, disconnect it.
// XpoDefault.Session and Session.DefaultSession can be used interchangeably.
if(XpoDefault.Session.IsConnected) {

// The default data access layer is created and connected to the database
// using the connection string.

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


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.

See Also