Proprietà Parent
Spazio dei nomi Microsoft.SqlServer.Management.Smo
Assembly: Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)
Sintassi
'Dichiarazione
<SfcObjectAttribute(SfcObjectRelationship.ParentObject, SfcObjectFlags.Design)> _
Public Property Parent As Database
Get
Set
'Utilizzo
Dim instance As Table
Dim value As Database
value = instance.Parent
instance.Parent = value
[SfcObjectAttribute(SfcObjectRelationship.ParentObject, SfcObjectFlags.Design)]
public Database Parent { get; set; }
[SfcObjectAttribute(SfcObjectRelationship::ParentObject, SfcObjectFlags::Design)]
public:
property Database^ Parent {
Database^ get ();
void set (Database^ value);
}
[<SfcObjectAttribute(SfcObjectRelationship.ParentObject, SfcObjectFlags.Design)>]
member Parent : Database with get, set
function get Parent () : Database
function set Parent (value : Database)
Valore proprietà
Tipo: Microsoft.SqlServer.Management.Smo. . :: . .Database
Valore dell'oggetto Database padre dell'oggetto Table.
Esempi
The following code example prints the name of the parent database for each AdventureWorks2008R2 table.
C#
Server srv = new Server("(local)");
Database db = srv.Databases["AdventureWorks2008R2"];
foreach (Table tb in db.Tables)
{
Database pnt = tb.Parent;
Console.WriteLine(pnt.Name);
}
Powershell
$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db = $srv.Databases.Item("AdventureWorks2008R2")
Foreach ($tb in $db.Tables)
{
Write-Host $tb.Parent.Name
}
Vedere anche