DatabaseFactory.CreateDatabase Method (String)

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Method for invoking a specified Database service object. Reads service settings from the ConnectionSettings.config file.

Namespace:  Microsoft.Practices.EnterpriseLibrary.Data
Assembly:  Microsoft.Practices.EnterpriseLibrary.Data (in Microsoft.Practices.EnterpriseLibrary.Data.dll)

Syntax

'Declaration
PublicSharedFunctionCreateDatabase ( _
    nameAs String _
) As Database
publicstatic Database CreateDatabase(
    string name
)
public:
static Database^ CreateDatabase(
    String^ name
)
publicstaticfunctionCreateDatabase(
    name : String
) : Database

Parameters

  • name
    Type: System.String
    configuration key for database service

Return Value

Database

Examples

            Database dbSvc = DatabaseFactory.CreateDatabase("SQL_Customers");
            

Exceptions

Exception Condition
System.Configuration.ConfigurationException

instanceName is not defined in configuration.

- or -

An error exists in the configuration.

- or -

An error occured while reading the configuration.

System.Reflection.TargetInvocationException

The constructor being called throws an exception.

See Also

DatabaseFactory Class

CreateDatabase Overload

Microsoft.Practices.EnterpriseLibrary.Data Namespace

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.