Aracılığıyla paylaş


Login.DefaultDatabase Property

Gets or sets the default database that the login account is assigned to after logging on to the instance of SQL Server.

This API is not CLS-compliant. 

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

Syntax

'Bildirim
<CLSCompliantAttribute(False)> _
<SfcReferenceAttribute(GetType(Database), "Server[@Name = '{0}']/Database[@Name = '{1}']",  _
    )> _
<SfcPropertyAttribute(SfcPropertyFlags.None Or SfcPropertyFlags.Standalone Or SfcPropertyFlags.SqlAzureDatabase,  _
    "master")> _
Public Property DefaultDatabase As String
    Get
    Set
'Kullanım
Dim instance As Login
Dim value As String

value = instance.DefaultDatabase

instance.DefaultDatabase = value
[CLSCompliantAttribute(false)]
[SfcReferenceAttribute(typeof(Database), "Server[@Name = '{0}']/Database[@Name = '{1}']", 
    )]
[SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Standalone|SfcPropertyFlags.SqlAzureDatabase, 
    "master")]
public string DefaultDatabase { get; set; }
[CLSCompliantAttribute(false)]
[SfcReferenceAttribute(typeof(Database), L"Server[@Name = '{0}']/Database[@Name = '{1}']", 
    )]
[SfcPropertyAttribute(SfcPropertyFlags::None|SfcPropertyFlags::Standalone|SfcPropertyFlags::SqlAzureDatabase, 
    L"master")]
public:
virtual property String^ DefaultDatabase {
    String^ get () sealed;
    void set (String^ value) sealed;
}
[<CLSCompliantAttribute(false)>]
[<SfcReferenceAttribute(typeof(Database), "Server[@Name = '{0}']/Database[@Name = '{1}']", 
    )>]
[<SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Standalone|SfcPropertyFlags.SqlAzureDatabase, 
    "master")>]
abstract DefaultDatabase : string with get, set
[<CLSCompliantAttribute(false)>]
[<SfcReferenceAttribute(typeof(Database), "Server[@Name = '{0}']/Database[@Name = '{1}']", 
    )>]
[<SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Standalone|SfcPropertyFlags.SqlAzureDatabase, 
    "master")>]
override DefaultDatabase : string with get, set
final function get DefaultDatabase () : String
final function set DefaultDatabase (value : String)

Property Value

Type: System.String
A String value that specifies the default database to which the login account is assigned after logging on to the instance of SQL Server.

Implements

ILoginOptions.DefaultDatabase

Remarks

Logins are assigned to a database by default after logging on to the instance of SQL Server that is equivalent to the USE DatabaseName Transact-SQL statement.

Examples

Managing Users, Roles, and Logins

See Also

Reference

Login Class

Microsoft.SqlServer.Management.Smo Namespace

Other Resources

Principals (Database Engine)

CREATE LOGIN (Transact-SQL)