The CommandText property on a Command object contains the text of a command that you want to issue against a provider. This property sets or returns a String value containing a provider command, such as an AS/400 Command Language (CL) command for execution by the remote OS/400 DDM target server. The default value for the CommandText property is a zero-length string.
previousCommandtext = command.CommandText
command.CommandText = "EXEC COMMAND DDMCmd"
The CommandText property is used to set or return the text of a Command object. The text can be an AS/400 CL command for execution by the remote OS/400 DDM target server or a request to open a table on a host (a remote DDM Server).
If the Prepared property of the Command object is set to True and the Command object is bound to an open connection when you set the CommandText property, ADO prepares the query when you call the Execute or Open methods.
Depending on the CommandType property setting, ADO may alter the CommandText property. The CommandText property can be read at any time to see the actual command text that ADO will use during execution.
The CommandText property defines the text version of a command. The syntax for the string in the CommandText property is as follows:
EXEC COMMAND DDMCmd
where DDMCmd represents a valid AS/400 CL command. The CommandType property specifies the type of command described in the CommandText property prior to execution in order to optimize performance. The CommandType property must be set to adCmdText for use with the OLE DB Provider for AS/400 and VSAM.
The Command object can also be used to open a data file after a Connection object has been opened and the ActiveConnection property has been set to this open connection. The CommandText property defines the data file to open. The syntax for the CommandText property string in this case is as follows:
EXEC OPEN DataSetName
where DataSetName represents a valid data file or library member on the host. The CommandType property must be set to adCmdText for use with the OLE DB Provider for AS/400 and VSAM. If you open a host data file from a Command object, then the data file is opened as read-only. This results from the limitation that no argument or option is passed by ADO that supplies a parameter describing whether the data set should be opened as read-only or updatable.