dotConnect for QuickBooks 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
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also