+ Reply to Thread
Results 1 to 3 of 3

Executing SQL Stored Procedure With Parameter Using ADO

  1. #1
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Executing SQL Stored Procedure With Parameter Using ADO

    Hi,

    I currently use 2 methods for Executing SQL Stored Procedure With Parameter Using ADO.

    Both work just fine. However the 2nd one is a bit complicated to remember and the 1st one is pretty straight forward.

    Just wanted to know if there are any drawbacks of using the 1st one over the 2nd one?

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Cheers!
    Deep Dave

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Executing SQL Stored Procedure With Parameter Using ADO

    In your scenario, it doesn't really matter. In general there are 2 main reasons why the second method is preferred.

    1. It allows output parameters, consider an update stored procedure, it may want to let you know how many rows were affected, typically this would be done using a return parameter. I don't believe you can get access to this via the first method (though I may be wrong, it's trivial in the second though) - hence the adparam input or adparam output.

    2 And the real reason this method is preferred, ado isn't just used in VBA and security can be important. The second method prevents SQL injection. This is less of a concern in excel since a hacker wouldn't resort to it, he'd simply read the code.

  3. #3
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: Executing SQL Stored Procedure With Parameter Using ADO

    Fair enough..

    I never thought of these 2 points...

    Thank you for clarifying..

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Executing SQL Stored Procs With Parameters Using VBA
    By NeedForExcel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-17-2015, 05:39 AM
  2. Replies: 0
    Last Post: 03-28-2013, 02:41 AM
  3. Replies: 0
    Last Post: 10-02-2012, 03:06 PM
  4. Replies: 2
    Last Post: 06-17-2012, 03:13 PM
  5. 2007 to call a Stored procedure with a parameter
    By oc_researcher in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-26-2011, 12:27 PM
  6. Executing a stored procedure in ORACLE from an EXCEL Macro thru ODBC.
    By ldevrries in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-10-2007, 04:59 PM
  7. Executing queries stored in database in Excel
    By John B in forum Excel General
    Replies: 0
    Last Post: 12-15-2005, 05:15 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1