Server.Databases Property
Represents a collection of Database objects. Each Database object represents a database defined on the instance of Microsoft SQL Server.
命名空间: Microsoft.SqlServer.Management.Smo
程序集: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)
语法
声明
Public ReadOnly Property Databases As DatabaseCollection
public DatabaseCollection Databases { get; }
public:
property DatabaseCollection^ Databases {
DatabaseCollection^ get ();
}
/** @property */
public DatabaseCollection get_Databases ()
public function get Databases () : DatabaseCollection
属性值
A DatabaseCollection object that represents all the databases defined on the instance of SQL Server.
备注
已更新的文本:
Specific databases can be referenced by using this collection and specifying the name of the database. To create a new database, call the database constructor Database.
仅 Microsoft .NET Framework 的 2.0 版本支持此命名空间、类或成员。
示例
'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'Modify a property using the Databases, Tables, and Columns collections to reference a column.
srv.Databases("AdventureWorks").Tables("Contact", "Person").Columns("LastName").Nullable = True
'Call the Alter method to make the change on the instance of SQL Server.
srv.Databases("AdventureWorks").Tables("Contact", "Person").Columns("LastName").Alter()
线程安全
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.
平台
开发平台
有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。
目标平台
有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。
请参阅
参考
Server Class
Server Members
Microsoft.SqlServer.Management.Smo Namespace
其他资源
How to: Reference an Object by Using a Collection in Visual Basic .NET
Using Collections
Creating, Altering, and Removing Databases
管理服务器