dotConnect for Adobe Commerce Documentation
Devart.Data.Magento Namespace / MagentoCommand Class / MagentoCommand Constructor / MagentoCommand Constructor(String,MagentoConnection)
The text of the query.
A MagentoConnection object that represents the connection to Adobe Commerce.
Example

In This Topic
    MagentoCommand Constructor(String,MagentoConnection)
    In This Topic
    Initializes a new instance of the MagentoCommand class with the text of the query and a %% object.
    Syntax
    'Declaration
     
    Public Function New( _
       ByVal commandText As String, _
       ByVal connection As MagentoConnection _
    )
    public MagentoCommand( 
       string commandText,
       MagentoConnection connection
    )

    Parameters

    commandText
    The text of the query.
    connection
    A MagentoConnection object that represents the connection to Adobe Commerce.
    Remarks
    The following table shows initial property values for an instance of MagentoCommand.
    Properties Initial value
    CommandText commandText
    CommandTimeout 30
    CommandType System.Data.CommandType.Text
    Connection connection
    Example
    The following example creates a MagentoCommand and sets some of its properties.
    public void CreateCommand()
    {
      MagentoConnection adobe commerceConnection = new MagentoConnection(
          "domain=192.168.10.68/magento;user=Test;apikey=testpassword;");
      string mySelectQuery = "SELECT * FROM Customers";
      MagentoCommand adobe commerceCommand = new MagentoCommand(mySelectQuery, adobe commerceConnection);
      adobe commerceCommand.FetchSize = 100;
    }
    Public Sub CreateCommand()
      Dim adobe commerceConnection As New MagentoConnection( _
        "domain=192.168.10.68/magento;user=Test;apikey=testpassword;")
      Dim mySelectQuery As String = _
        "SELECT * FROM Customers"
      Dim adobe commerceCommand As New MagentoCommand(mySelectQuery, adobe commerceConnection)
      adobe commerceCommand.FetchSize = 100
    End Sub
    See Also