System.Data.SqlClient.SqlConnection.Database Property

Gets the name of the current database or the database to be used after a connection is opened.

Syntax

[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public override string Database { get; }

Value

Gets a string value representing the current SQL Server database.

Remarks

The SqlConnection.Database property updates dynamically. If you change the current database using a tsql statement or the SqlConnection.ChangeDatabase(string) method, an informational message is sent and the property is updated automatically.

Requirements

Namespace: System.Data.SqlClient
Assembly: System.Data (in System.Data.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0