InstanceDatabaseFileCollection.Add Method
Adds an InstanceDatabaseFile to the InstanceDatabaseFileCollection.
Espace de noms: Microsoft.SqlServer.Management.Nmo
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)
Syntaxe
'Déclaration
Public Sub Add ( _
instanceDatabaseFiles As InstanceDatabaseFile _
)
public void Add (
InstanceDatabaseFile instanceDatabaseFiles
)
public:
void Add (
InstanceDatabaseFile^ instanceDatabaseFiles
)
public void Add (
InstanceDatabaseFile instanceDatabaseFiles
)
public function Add (
instanceDatabaseFiles : InstanceDatabaseFile
)
Paramètres
- instanceDatabaseFiles
Adds an InstanceDatabaseFile to the InstanceDatabaseFileCollection.
Notes
The following examples show how to add a data file to a filegroup using the InstanceDatabaseFileCollection object returned by the InstanceDatabaseFiles property of an InstanceDatabaseFileGroup object (idb_fg):
InstanceDatabaseFileGroup idb_fg =
new InstanceDatabaseFileGroup(idb, "PRIMARY");
idb.InstanceDatabaseFileGroups.Add(idb_fg);
// Define and add a data file
InstanceDatabaseFile idb_file1 =
new InstanceDatabaseFile(idb_fg, "MyInst_PrimaryFile1");
idb_file1.FileName = @"C:\NS\Full\MyInst_PrimaryFile1.mdf";
idb_file1.InitialSize = "5MB";
idb_file1.MaxSize = "15MB";
idb_file1.GrowthIncrement = "10%";
idb_fg.InstanceDatabaseFiles.Add(idb_file1);
' Define and add a filegroup
Dim idb_fg As InstanceDatabaseFileGroup = _
New InstanceDatabaseFileGroup(idb, "PRIMARY")
idb.InstanceDatabaseFileGroups.Add(idb_fg)
' Define and add a data file
Dim idb_file1 As InstanceDatabaseFile = _
New InstanceDatabaseFile(idb_fg, "MyInst_PrimaryFile1")
idb_file1.FileName = "C:\NS\Full\MyInst_PrimaryFile1.mdf"
idb_file1.InitialSize = "5MB"
idb_file1.MaxSize = "15MB"
idb_file1.GrowthIncrement = "10%"
idb_fg.InstanceDatabaseFiles.Add(idb_file1)
Sécurité des threads
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.
Plateformes
Plateformes de développement
Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.
Plateformes cibles
Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.
Voir aussi
Référence
InstanceDatabaseFileCollection Class
InstanceDatabaseFileCollection Members
Microsoft.SqlServer.Management.Nmo Namespace
Autres ressources
Définition de la base de données d'instance
FileSpec Element (ICF)