+ Reply to Thread
Results 1 to 6 of 6

Execute Stored Proc Using ADODB

  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,873

    Execute Stored Proc Using ADODB

    Hi,

    I use a Stored Proc which runs in SSMS properly.

    It needs a Parameter that is actually a string of XML Tags which I generate in excel. This generates perfectly as well. I can say this as I copy the generated XML and paste it in the parameter and the Stored Proc Runs perfect.

    The Problem is, when I use ADODB to Execute this stored Proc from Excel VBA, the stored Proc does not seem to work in SSMS.

    Here is the Code -

    Please Login or Register  to view this content.
    Note: The SourceQuery variable has all the required things to run the SQL Stored Proc, like the EXECUTE Statement etc.
    Last edited by NeedForExcel; 05-20-2015 at 05:17 AM.
    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,238

    Re: Execute Stored Proc Using ADODB

    Why use a recordset at all? You aren't returning anything, just use the execute method of the connection object

  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,873

    Re: Execute Stored Proc Using ADODB

    Yes I got that and I added these below lines before the With SQLRecordSet statement.

    Please Login or Register  to view this content.
    But the funny thing is, when I comment the With End With SQLRecordSet lines, the data stops updating in SSMS.

    Not sure why..

    Now the Code looks like this -

    Please Login or Register  to view this content.

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

    Re: Execute Stored Proc Using ADODB

    So remove the recordset?

    Please Login or Register  to view this content.
    So the below should be sufficient:
    Please Login or Register  to view this content.
    Last edited by Kyle123; 05-20-2015 at 06:18 AM.

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

    Re: Execute Stored Proc Using ADODB

    Runs perfectly..

    Thank you Kyle..

    Rep Added, Thread marked as solved..

    I also have another issue, I guess Ill have a new post for that..

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

    Re: Execute Stored Proc Using ADODB

    Glad it helped

+ 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. Running SQL Stored Proc through Excel VBA
    By JezLisle in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-09-2009, 07:47 AM
  2. [SOLVED] SQL Stored proc - passing parameters
    By Harish Mohanbabu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-20-2006, 01:00 PM
  3. [SOLVED] execute stored proc in Excel
    By William in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-05-2006, 06:55 PM
  4. DAO recordset Call to SQL Stored Proc
    By Datasort in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-01-2005, 02:10 PM
  5. execte stored proc
    By maxzsim in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-10-2005, 01:06 PM

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