次の方法で共有


SPDatabaseCollection class

Represents a collection of SPDatabase objects.

Inheritance hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPPersistedObjectCollection<SPDatabase>
    Microsoft.SharePoint.Administration.SPPersistedChildCollection<SPDatabase>
      Microsoft.SharePoint.Administration.SPDatabaseCollection

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
<GuidAttribute("B8AAC2DE-4DD1-49fa-8D6C-B369ED1B906E")> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class SPDatabaseCollection _
    Inherits SPPersistedChildCollection(Of SPDatabase)
'Usage
Dim instance As SPDatabaseCollection
[GuidAttribute("B8AAC2DE-4DD1-49fa-8D6C-B369ED1B906E")]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class SPDatabaseCollection : SPPersistedChildCollection<SPDatabase>

Remarks

Use the Databases property of the SPDatabaseServiceInstance class, or the SPDatabaseCollection constructor, to return the collection of databases that support a database service instance.

To add a database to the collection, use the Add method.

Use an indexer to return a single database from the collection. For example, if the collection is assigned to a variable named myDatabases, use myDatabases[index] in C#, or myDatabases(index) in Visual Basic, where index is either the name or the GUID identifying the database.

Thread safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See also

Reference

SPDatabaseCollection members

Microsoft.SharePoint.Administration namespace