Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Calling sproc with parameters with ADODB

  • 13-11-2008 04:41PM
    #1
    Registered Users, Registered Users 2 Posts: 872 ✭✭✭


    Hi,

    I am trying to call a stored procedure with ASP JSCRIPT and pass in 1 parameter:
    var cn = Server.CreateObject("ADODB.Connection");
        var cmd = Server.CreateObject("ADODB.Command");
        cn.Open ("DSN=xxx;UID=xx;PWD=xx;INITIAL CATALOG=xxx");
        cmd.ActiveConnection = cn;
        
        cmd.CommandText = "sproc name";
        cmd.CommandType = 4;
        
        cmd.Parameters.Refresh
        cmd.Parameters(1).Value = 'test value'
        
        cmd.Execute();
    

    If i add a parameter with data length, direction etc it works but i need to only specify the param name and the value

    The error i am getting is :
    ADODB.Command error '800a0cc1' 
    
    Item cannot be found in the collection corresponding to the requested name or ordinal.
    

    Anyone any ideas ??

    Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 610 ✭✭✭nialo


    Think the parameter should start at zero not 1.

    cmd.Parameters(0)


Advertisement