NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

SQLConnection Constructor (String, String, String, String)

Initializes a new instance of the SQLConnection class when given a server, a password, an user ID, and a database to connect to.

[Visual Basic]
Overloads Public Sub New( _
   ByVal dataSource As String, _
   ByVal userID As String, _
   ByVal password As String, _
   ByVal database As String _
)
[C#]
public SQLConnection(
   string dataSource,
   string userID,
   string password,
   string database
);
[C++]
public: SQLConnection(
   String* dataSource,
   String* userID,
   String* password,
   String* database
);
[JScript]
public function SQLConnection(
   dataSource : String,
   userID : String,
   password : String,
   database : String
);

Parameters

dataSource
The name of the server that SQL Server resides on.
userID
The user identification for SQL Server.
password
The user password for SQL Server.
database
The name of the database in SQL Server to connect to.

Exceptions

Exception Type Condition
Exception The connection could not be mapped properly.

-or-

An improper argument was passed or an argument was missing.

Remarks

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 database
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.

Example

The following example creates a SQLConnection and sets some of its properties.

See Also

SQLConnection Class | SQLConnection Members | System.Data.SQL Namespace | SQLConnection Constructor Overload List