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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Calling sproc with parameters with ADODB

  • 13-11-2008 4: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