Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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.

Exception Condition
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
Available since 2.0
Return to top
Show:
© 2017 Microsoft