DbConnection.DataSource Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
When overridden in a derived class, gets the name of the database server to which to connect.
public:
abstract property System::String ^ DataSource { System::String ^ get(); };
public abstract string DataSource { get; }
member this.DataSource : string
Public MustOverride ReadOnly Property DataSource As String
The name of the database server to which to connect. The default value is an empty string.
If the connection to the database is closed, the DataSource returns whatever is contained in the ConnectionString for the DataSource
keyword. If the connection is open and the ConnectionString data source keyword's value starts with "|datadirectory
|", the property returns whatever is contained in the ConnectionString for the DataSource
keyword only. If the connection to the database is open, the property returns what the native provider returns for the DBPROP_INIT_DATASOURCE
, and if that is empty, the native provider's DBPROP_DATASOURCENAME
is returned.
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: