dotConnect for QuickBooks Online Documentation
Devart.Data.QuickBooks Namespace / QuickBooksConnection Class / CreateCommand Method
Example

In This Topic
    CreateCommand Method (QuickBooksConnection)
    In This Topic
    Creates and returns a QuickBooksCommand object associated with the QuickBooksConnection.
    Creates and returns a QuickBooksCommand object associated with the QuickBooksConnection.
    Syntax
    'Declaration
     
    Public Shadows Function CreateCommand() As QuickBooksCommand
    public new QuickBooksCommand CreateCommand()

    Return Value

    Remarks
    You can use this method as an alternative to common QuickBooksCommand constructors.
    Example
    In this sample QuickBooksCommand object is created. It is automatically associated with QuickBooksConnection that created it.
    public void CreateQuickBooksCommand(string myConnString)
    {
      QuickBooksConnection quickBooksConnection = new QuickBooksConnection(myConnString);
      QuickBooksCommand quickBooksCommand = quickBooksConnection.CreateCommand();
      quickBooksCommand.CommandText = "INSERT INTO Customer (DisplayName, Notes) VALUES ('John Smith', 'VIP Customer')";
      quickBooksConnection.Open();
      try
      {
        quickBooksCommand.ExecuteNonQuery();
      }
      finally
      {
        quickBooksConnection.Close();
      }
    }
    Public Sub CreateQuickBooksCommand(ByVal myConnString As String)
      Dim quickBooksConnection As New QuickBooksConnection(myConnString)
      Dim quickBooksCommand As QuickBooksCommand = quickBooksConnection.CreateCommand()
      quickBooksCommand.CommandText = "INSERT INTO Customer (DisplayName, Notes) VALUES ('John Smith', 'VIP Customer')"
      quickBooksConnection.Open()
      Try
        quickBooksCommand.ExecuteNonQuery()
      Finally
        quickBooksConnection.Close()
      End Try
    End Sub
    See Also