Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

SqlConnectionStringBuilder::DataSource Property

Gets or sets the name or network address of the instance of SQL Server to connect to.

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

public:
property String^ DataSource {
	String^ get ();
	void set (String^ value);
}

Property Value

Type: System::String
The value of the DataSource property, or String.Empty if none has been supplied.

ExceptionCondition
ArgumentNullException

To set the value to null, use Value.

This property corresponds to the "Data Source", "server", "address", "addr", and "network address" keys within the connection string. Regardless of which of these values has been supplied within the supplied connection string, the connection string created by the SqlConnectionStringBuilder will use the well-known "Data Source" key.

The following example demonstrates that the SqlConnectionStringBuilder class converts synonyms for the "Data Source" connection string key into the well-known key:

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft