Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2013

    Unanswered: What is the difference between Connection.Execute and Command.Execute in ADO?


    I am using ADO/Visual C++ to access SQL Server database engine. I find both the connection and command object has Execute method, as below: (ADO Connection) (ADO Command)

    Both will execute the SQL query and return a recordset.

    In that case, what is the difference between them and why MS will provide two functions with same functionalities?

  2. #2
    Join Date
    Jan 2016
    Provided Answers: 1
    Both connection.Execute and Command.Execute "execute" statements (queries, stored procedures) against any database.

    Command.Execute is more versatile, gives you more options, is probably more efficient. It allows you to setup parameters for your SQL statements, stored procedures, create Prepared statements etc. You can retrieve information from stored procedure Output and Return Value parameters. 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts