DB2Connection Constructor ()
Initializes a new instance of the DB2Connection class.
- Namespace:
IBM.Data.DB2
- Assembly:
IBM.Data.DB2
(inIBM.Data.DB2.dll
)
Syntax
[Visual Basic]
Public Sub New()
[C#]
public DB2Connection();
[C++]
public: DB2Connection();
[JScript]
public function DB2Connection();
Remarks
When a new instance of DB2®Connection is created, the read/write properties are set to the following initial values unless they are specifically set using their associated keywords in the ConnectionString property.
Properties | Initial value |
---|---|
ConnectionString | empty string ("") |
Database | empty string ("") |
You can change the value for these properties only by using the ConnectionString property.
Example
[Visual Basic, C#] The following example creates and opens a DB2Connection .
[Visual Basic]
Public Sub CreateDB2Connection()
Dim myConnection As New DB2Connection()
myConnection.ConnectionString = "DATABASE=SAMPLE;"
myConnection.Open()
End Sub
[C#]
public void CreateDB2Connection()
{
DB2Connection myConnection = new DB2Connection();
myConnection.ConnectionString = "DATABASE=SAMPLE;";
myConnection.Open();
}