Initializes a new instance of the SQLConnection class when given a server, a password and a user ID.
[Visual Basic] Overloads Public Sub New( _ ByVal dataSource As String, _ ByVal userID As String, _ ByVal password As String _ ) [C#] public SQLConnection( string dataSource, string userID, string password ); [C++] public: SQLConnection( String* dataSource, String* userID, String* password ); [JScript] public function SQLConnection( dataSource : String, userID : String, password : String );
Exception Type | Condition |
---|---|
Exception | The connection could not be mapped properly.
An improper argument was passed or argument was missing. |
When an instance of SQLConnection is created, the following read/write properties are set to initial values.
Properties | Initial Value |
---|---|
ConnectionString | empty string ("") |
ConnectionTimeout | 15 |
Database | empty string ("") |
IsolationLevel | Unspecified |
DataSource | dataSource |
UserID | userID |
Password | password |
You can change the value for any of these properties through a separate call to the property.
The following example creates a SQLConnection and sets some of its properties.
SQLConnection Class | SQLConnection Members | System.Data.SQL Namespace | SQLConnection Constructor Overload List