Database 构造函数

Initializes a new instance of the Database class.

命名空间:  Microsoft.SqlServer.Management.Smo
程序集:  Microsoft.SqlServer.Smo(在 Microsoft.SqlServer.Smo.dll 中)

语法

声明
Public Sub New
用法
Dim instance As New Database()
public Database()
public:
Database()
new : unit -> Database
public function Database()

注释

默认构造函数将所有字段初始化为其默认值。

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

示例

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()

请参阅

参考

Database 类

Database 重载

Microsoft.SqlServer.Management.Smo 命名空间

其他资源

使用数据库对象

创建、更改和删除数据库

CREATE DATABASE (Transact-SQL)