DB2 10.5 for Linux, UNIX, and Windows

DB2Command Constructor (String)

Initializes a new instance of the DB2Command class with the text of the query.

Namespace:
IBM.Data.DB2
Assembly:
IBM.Data.DB2 (in IBM.Data.DB2.dll)

Syntax

[Visual Basic]
Public Sub New( _
   ByVal cmdText As String _
)
[C#]
public DB2Command(
   string cmdText
);
[C++]
public: DB2Command(
   String* cmdText
);
[JScript]
public function DB2Command(
   cmdText : String
);

Parameters

cmdText
The text of the query.

Example

[Visual Basic, C#] The following example creates a DB2®Command and sets some of its properties.

[Visual Basic]
Public Sub CreateMyDB2Command()
    Dim mySelectQuery As String = "SELECT * FROM EMPLOYEE ORDER BY EMPNO"
    Dim myCommand As New DB2Command(mySelectQuery)
    myCommand.CommandTimeout = 20
End Sub

[C#]
public void CreateMyDB2Command()
{
   string mySelectQuery = "SELECT * FROM EMPLOYEE ORDER BY EMPNO";
   DB2Command myCommand = new DB2Command(mySelectQuery);
   myCommand.CommandTimeout = 20;
}