Share via


Constructeur Database

Initialise une nouvelle instance de la classe Database.

Espace de noms :  Microsoft.SqlServer.Management.Smo
Assembly :  Microsoft.SqlServer.Smo (en Microsoft.SqlServer.Smo.dll)

Syntaxe

'Déclaration
Public Sub New
'Utilisation

Dim instance As New Database()
public Database()
public:
Database()
new : unit -> Database
public function Database()

Notes

Le constructeur par défaut rétablit les valeurs par défaut de tous les champs.

You will have to specify which server is the parent of the database before you can create a database.

Exemples

VB

Dim srv As Server
srv = New Server()

'Create a new database by using the default constructor.
Dim db As Database
db = New Database
db.Name = "New_Database"
db.Parent = srv
db.Create()

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db.Name = "New_Database"
$db.Parent = $srv
$db.Create()