Gets or sets the name of the database to connect to.
[Visual Basic] Public Property DataSource As String [C#] public string DataSource {get; set;} [C++] public: __property String* get_DataSource(); public: __property void set_DataSource(String*); [JScript] public function get DataSource() : String; public function set DataSource(String);
The name of the database to connect to. The default value is an empty string.
Exception Type | Condition |
---|---|
OpenConVariable | The connection is open. You must first close the connection. |
BrokenConError | The connection is broken. |
The DataSource property overwrites the cooresponding property within the connection string.
Note This property is read-only while the connection is open.
The following example creates a SQLConnection and sets some of its properties.
SQLConnection Class | SQLConnection Members | System.Data.SQL Namespace | ConnectionString | ConnectionTimeout | Database | UserID | Password | IsolationLevel