AccessConnectionProviderMultiUserThreadSafe.GetConnectionString(String, String, String) Method
Returns a connection string to the specified MS Access data base using the specified credentials.
A string that specifies the path and name of the data base to connect to.
A string that specifies the user’s name. This is used to initialize the “User ID” field of the connection string.
A string that specifies the password. This is used to initialize the “Password” field of the connection string.
A connection string.
The database parameter specifies the name of the database. If the full path is omitted it is assumed that the database resides in the same folder as the application’s executable file.
This method sets the connection string’s “User ID” field to “Admin” and the password to an empty string.
The string returned by the GetConnectionString method contains an extra parameter that identifies the database type to which a connection should be established, so it’s not fully compatible with the standard connection string format. When a Session receives this connection string it removes this extra parameter and then passes the valid connection string to the database.
The following code demonstrates how to connect to an MS Access database. The AccessConnectionProvider.GetConnectionString method is called to construct a connection string to the database. It’s then assigned to the XpoDefault.ConnectionString property.
When a connection is about to be established to a database, a session object obtains the connection string from the XpoDefault.ConnectionString property (unless another connection string is supplied directly to the session). This is then used to connect to the database.
using DevExpress.Xpo; using DevExpress.Xpo.DB; XpoDefault.ConnectionString = AccessConnectionProvider.GetConnectionString( @"c:\Data\nwind.mdb");