DatabaseFactoryCreateDatabase 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)

public static Database CreateDatabase(
	string name
)

Parameters

name
Type: SystemString
configuration key for database service

Return Value

Database


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

ExceptionCondition
System.ConfigurationConfigurationException

instanceName is not defined in configuration.

- or -

An error exists in the configuration.

- or -

An error occured while reading the configuration.

System.ReflectionTargetInvocationException

The constructor being called throws an exception.

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.

Show: