SqlConnection.Database Property

 

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

Namespace:   System.Data.SqlClient
Assembly:  System.Data (in System.Data.dll)

override Database : string with get

Property Value

Type: System.String

The name of the current database or the name of the database to be used after a connection is opened. The default value is an empty string.

The Database property updates dynamically. If you change the current database using a Transact-SQL statement or the ChangeDatabase method, an informational message is sent and the property is updated automatically.

The following example creates a SqlConnection and displays some of its read-only properties.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: