Partilhar via


Server Constructor ()

Initializes a new instance of the Server class.

Namespace: Microsoft.SqlServer.Management.Smo
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Syntax

'Declaration
Public Sub New
public Server ()
public:
Server ()
public Server ()
public function Server ()

Remarks

Updated text:

The default constructor initializes any fields to their default values.

This namespace, class, or member is supported only in version 2.0 of the Microsoft .NET Framework.

Example

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'The connection is established when a property is requested.
Console.WriteLine(srv.Information.Version)
'The connection is automatically disconnected when the Server variable goes out of scope.

Platforms

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

See Also

Reference

Server Class
Server Members
Microsoft.SqlServer.Management.Smo Namespace

Other Resources

How to: Connect to the Local Instance of SQL Server by Using Windows Authentication in Visual Basic .NET
Connecting to an Instance of SQL Server
Disconnecting from an Instance of SQL Server
Managing Servers

Change History

Release

History

New content:
  • Added code sample to the Example section.