Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2013
    Thanked 0 Times in 0 Posts

    Question Problem accessing stored procedure in classic ASP

    Hello. I need some help.

    I have a stored procedure named createID on a MS SQL Server database. The procedure takes no input, and returns a BigInt.

    I can call it from my SQL Server client as follows:

    declare @foo BIGINT
    execute createID @foo OUTPUT;
    select @foo as "FaxID";
    The above works, and the procedure returns a number as expected. However, I have problems trying to call it from (classic) ASP.

    I have tried the following:

    Function getFaxId(ConnString)
       Dim Connection, cmd
       Set Connection = Server.CreateObject("ADODB.Connection")
       Connection.Open ConnString
       Set cmd = Server.CreateObject("ADODB.Command")
       Set cmd.ActiveConnection = Connection
       cmd.CommandText = "createID"
       cmd.CommandType = adCmdStoredProc
       cmd.Parameters.Append cmd.CreateParameter("FaxID", adBigInt, adParamOutput)
       getFaxId = cmd(0)
       Set cmd=nothing
       Set Connection=nothing
    End Function
    When I call the above function using the connection string for the database (the connection string is right, it works on other functions), I get the following IIS error:


    I have also tried the following variants:
    1. cmd.CreateParameter("FaxID", adBigInt, adParamReturnValue)
    2. cmd.CreateParameter("FaxID", adBigInt, _, adParamOutput)
    3. cmd.CreateParameter("FaxID", adBigInt, _, adParamReturnValue)

    Neither has worked. They all yield the same error message.

    Does anyone have any idea what may be wrong? (Sorry, it's my first time calling a stored procedure from ASP and I can't seem to find the answer online).

    Thank you in advance.

  2. #2
    New to the CF scene
    Join Date
    Oct 2013
    Thanked 0 Times in 0 Posts

    Thumbs up

    Problem solved thanks to a friend!

    I was missing the following line:

    <!--METADATA TYPE="TypeLib" NAME="Microsoft ActiveX Data Objects 2.6 Library" UUID="{00000206-0000-0010-8000-00AA006D2EA4}" VERSION="2.6"-->


Posting Permissions

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