Synopsis

Close the SqlConnection.

Syntax

Close-SqlConnection [[-ConnectionName] <String>] [<CommonParameters>]

Description

Closes the connection and disposes of the underlying object. This will also rollback the current transaction if there is one.

Parameters

-ConnectionName <String>

User defined name for connection.

Required? False
Position? 0
Default value Default
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? False

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

Examples

Example 1

PS C:\> Close-SqlConnection

Closes the default connection (same as Close-SqlConnection "Default").

Example 2

PS C:\> Close-SqlConnection -ConnectionName Test

Closes the SqlConnection named "Test".

Last edited Jun 20, 2015 at 5:44 PM by mastertook, version 2