Freigeben über


ApplicationDatabaseFileCollection.Add Method

Adds an ApplicationDatabaseFile to the collection.

Namespace: Microsoft.SqlServer.Management.Nmo
Assembly : Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Syntax

'Declaration
Public Sub Add ( _
    applicationDatabaseFiles As ApplicationDatabaseFile _
)
public void Add (
    ApplicationDatabaseFile applicationDatabaseFiles
)
public:
void Add (
    ApplicationDatabaseFile^ applicationDatabaseFiles
)
public void Add (
    ApplicationDatabaseFile applicationDatabaseFiles
)
public function Add (
    applicationDatabaseFiles : ApplicationDatabaseFile
)

Parameter

Beispiel

The following examples show how to define an application database file and then add it to the ApplicationDatabaseOptions object using this Add method.

// Define and add a filegroup
ApplicationDatabaseFileGroup adb_fg = 
    new ApplicationDatabaseFileGroup(adb, "PRIMARY");
adb.ApplicationDatabaseFileGroups.Add(adb_fg);

// Define and add a database file
ApplicationDatabaseFile adb_file1 = 
    new ApplicationDatabaseFile(adb_fg, "MyApp_PrimaryFile1");
adb_file1.FileName = @"C:\NS\Full\MyApp_PrimaryFile1.mdf";
adb_file1.InitialSize = "10MB";
adb_file1.MaxSize = "50MB";
adb_file1.GrowthIncrement = "10%";
adb_fg.ApplicationDatabaseFiles.Add(adb_file1);
' Define and add a filegroup
Dim adb_fg As ApplicationDatabaseFileGroup = _
    New ApplicationDatabaseFileGroup(adb, "PRIMARY")
adb.ApplicationDatabaseFileGroups.Add(adb_fg)

' Define and add a database file
Dim adb_file1 As ApplicationDatabaseFile = _
    New ApplicationDatabaseFile(adb_fg, "MyApp_PrimaryFile1")
adb_file1.FileName = "C:\NS\Full\MyApp_PrimaryFile1.mdf"
adb_file1.InitialSize = "10MB"
adb_file1.MaxSize = "50MB"
adb_file1.GrowthIncrement = "10%"
adb_fg.ApplicationDatabaseFiles.Add(adb_file1)

Threadsicherheit

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

Plattformen

Entwicklungsplattformen

Eine Liste der unterstützten Plattformen finden Sie unterHardware- und Softwareanforderungen für die Installation von SQL Server 2005.

Zielplattforme

Eine Liste der unterstützten Plattformen finden Sie unterHardware- und Softwareanforderungen für die Installation von SQL Server 2005.

Siehe auch

Verweis

ApplicationDatabaseFileCollection Class
ApplicationDatabaseFileCollection Members
Microsoft.SqlServer.Management.Nmo Namespace

Andere Ressourcen

Definieren der Anwendungsdatenbank
Database Element (ADF)