Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Calling sproc with parameters with ADODB

Options
  • 13-11-2008 5:41pm
    #1
    Registered Users 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 Posts: 610 ✭✭✭nialo


    Think the parameter should start at zero not 1.

    cmd.Parameters(0)


Advertisement