次の方法で共有


FileGroups プロパティ

FileGroup オブジェクトのコレクションを表します。各 FileGroup オブジェクトは、データベースで定義されたファイル グループを表します。

名前空間:  Microsoft.SqlServer.Management.Smo
アセンブリ:  Microsoft.SqlServer.Smo (Microsoft.SqlServer.Smo.dll)

構文

'宣言
<SfcObjectAttribute(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.OneToAny, GetType(FileGroup))> _
Public ReadOnly Property FileGroups As FileGroupCollection
    Get
'使用
Dim instance As Database
Dim value As FileGroupCollection

value = instance.FileGroups
[SfcObjectAttribute(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.OneToAny, typeof(FileGroup))]
public FileGroupCollection FileGroups { get; }
[SfcObjectAttribute(SfcContainerRelationship::ChildContainer, SfcContainerCardinality::OneToAny, 
    typeof(FileGroup))]
public:
property FileGroupCollection^ FileGroups {
    FileGroupCollection^ get ();
}
[<SfcObjectAttribute(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.OneToAny, 
    typeof(FileGroup))>]
member FileGroups : FileGroupCollection
function get FileGroups () : FileGroupCollection

プロパティ値

型: Microsoft.SqlServer.Management.Smo. . :: . .FileGroupCollection
データベースで定義されたすべてのファイル グループを表す FileGroupCollection オブジェクト。

説明

このコレクションを使用し、ファイル グループ名を指定することによって、特定のファイル グループを参照できます。新しいファイル グループをコレクションに追加するには、ファイル グループ コンストラクター FileGroup を呼び出します。

使用例

VB

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server

'Reference the AdventureWorks2008R2 database.
Dim db As Database
db = srv.Databases("AdventureWorks2008R2")

'Display all the log files in the database.
Dim lf As LogFile
For Each lf In db.LogFiles
   Console.WriteLine(lf.Name)
Next

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db = $srv.Databases.Item("AdventureWorks2008R2")

Foreach ($lf in $db.LogFiles)
{
   Write-Host $lf.Name
}