Initializes a new instance of the DB2Command class with the text of the query and a DB2Connection object.
[Visual Basic]
Public Sub New( _
ByVal cmdText As String, _
ByVal connection As DB2Connection _
)
[C#]
public DB2Command(
string cmdText,
DB2Connection connection
);
[C++]
public: DB2Command(
String* cmdText,
DB2Connection * connection
);
[JScript]
public function DB2Command(
cmdText : String,
connection : DB2Connection
);
[Visual Basic, C#] The following example creates a DB2®Command and sets some of its properties.
[Visual Basic]
Public Sub CreateMyDB2Command()
Dim myConnection As New DB2Connection _
("DATABASE=SAMPLE;")
Dim mySelectQuery As String = _
"SELECT * FROM EMPLOYEE ORDER BY EMPNO"
Dim myCommand As New DB2Command(mySelectQuery, myConnection)
myCommand.CommandTimeout = 20
End Sub
[C#]
public void CreateMyDB2Command()
{
DB2Connection myConnection = new DB2Connection("DATABASE=SAMPLE;");
string mySelectQuery = "SELECT * FROM EMPLOYEE ORDER BY EMPNO";
DB2Command myCommand = new DB2Command(mySelectQuery, myConnection);
myCommand.CommandTimeout = 20;
}