Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6061771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:58:31+00:00 2026-05-23T08:58:31+00:00

Using the below functions how could I use a stored procedure with parameters. I

  • 0

Using the below functions how could I use a stored procedure with parameters.

I have to call a stored procedure using parameters for work experience but i can’t seem to work how this would work, usually i would have a command.execute in a recordset parameter then loop through the recordset to get my output.

The below functions are a selected few of which I narrowed down to use. I have called a stored procedure using the recordset function.

recordset

    function Recordset(sNewCommandText, iNewCommandType, iNewCommandTimeout, lng_RecordsetNumber)
            obj_Command.CommandText = sNewCommandText
            if IsNumeric(iNewCommandType) then
                obj_Command.CommandType = iNewCommandType
            else
                obj_Command.CommandType = 1
            end if
            if IsNumeric(iNewCommandTimeout) then
                obj_Command.CommandTimeout = iNewCommandTimeout
            else
                obj_Command.CommandTimeout = 3
            end if
            if RecordsetIsOpen(lng_RecordsetNumber) = 1 then
                CloseRecordset lng_RecordsetNumber
            end if
            select case lng_RecordsetNumber
                case 0
                case 1
                    obj_Recordset1.Open obj_Command
                case 2
                    obj_Recordset2.Open obj_Command
                case 3
                    obj_Recordset3.Open obj_Command
                case else
                    obj_ExtraRecSets.Item(lng_RecordsetNumber).Open obj_Command
            end select
        end function

Execute

    function Execute(sNewCommandText, iNewCommandType, iNewCommandTimeout)
        Execute= 0
        obj_Command.CommandText = sNewCommandText
        if IsNumeric(iNewCommandType) then
            obj_Command.CommandType = iNewCommandType
        else
            obj_Command.CommandType = 1
        end if
        if IsNumeric(iNewCommandTimeout) then
            obj_Command.CommandTimeout = iNewCommandTimeout
        else
            obj_Command.CommandTimeout = 3
        end if
        obj_Command.Execute
        Execute= 1
    end function

Get field

function GetField(FieldNumber, iFieldAttribute, lng_RecordsetNumber)
        dim lng_tmpcnt
        if RecordsetIsOpen(lng_RecordsetNumber) = 1 and IsNumeric(iFieldAttribute) and BOF(lng_RecordsetNumber) = 0 and EOF(lng_RecordsetNumber) = 0 then
            select case iFieldAttribute
                case 0
                    select case lng_RecordsetNumber
                        case 1
                            GetField = obj_Recordset1.Fields(FieldNumber).Type
                        case 2
                            GetField = obj_Recordset2.Fields(FieldNumber).Type
                        case 3
                            GetField = obj_Recordset3.Fields(FieldNumber).Type
                        case else
                            GetField = obj_ExtraRecSets.Item(lng_RecordsetNumber).Fields(FieldNumber).Type
                    end select
                case 1
                    select case lng_RecordsetNumber
                        case 1
                            GetField = obj_Recordset1.Fields(FieldNumber).Name
                        case 2
                            GetField = obj_Recordset2.Fields(FieldNumber).Name
                        case 3
                            GetField = obj_Recordset3.Fields(FieldNumber).Name
                        case else
                            GetField = obj_ExtraRecSets.Item(lng_RecordsetNumber).Fields(FieldNumber).Name
                    end select 
                case 2
                    select case lng_RecordsetNumber
                        case 1
                            GetField = obj_Recordset1.Fields(FieldNumber).Value
                        case 2
                            GetField = obj_Recordset2.Fields(FieldNumber).Value
                        case 3
                            GetField = obj_Recordset3.Fields(FieldNumber).Value
                        case else
                            GetField = obj_ExtraRecSets.Item(lng_RecordsetNumber).Fields(FieldNumber).Value
                    end select
                case 3
                    select case lng_RecordsetNumber
                        case 1
                            GetField = obj_Recordset1.Fields(FieldNumber).ActualSize
                        case 2
                            GetField = obj_Recordset2.Fields(FieldNumber).ActualSize
                        case 3
                            GetField = obj_Recordset3.Fields(FieldNumber).ActualSize
                        case else
                            GetField = obj_ExtraRecSets.Item(lng_RecordsetNumber).Fields(FieldNumber).ActualSize
                    end select
                case else
                    select case lng_RecordsetNumber
                        case 1
                            for lng_tmpcnt=0 to obj_Recordset1.Fields(FieldNumber).Properties.count-1
                                if lng_tmpcnt <> 15 and lng_tmpcnt <> 17 then
                                    GetField = GetField & lng_tmpcnt & " (" & obj_Recordset1.Fields(FieldNumber).Properties(lng_tmpcnt).name & "(" & obj_Recordset1.Fields(FieldNumber).Properties(lng_tmpcnt).type & ")= " & obj_Recordset1.Fields(FieldNumber).Properties(lng_tmpcnt).value & ")<br>" & vbcrlf
                                end if
                            next 
                        case 2
                            for lng_tmpcnt=0 to obj_Recordset2.Fields(FieldNumber).Properties.count-1
                                if lng_tmpcnt <> 15 and lng_tmpcnt <> 17 then
                                    GetField = GetField & lng_tmpcnt & " (" & obj_Recordset2.Fields(FieldNumber).Properties(lng_tmpcnt).name & "(" & obj_Recordset2.Fields(FieldNumber).Properties(lng_tmpcnt).type & ")= " & obj_Recordset1.Fields(FieldNumber).Properties(lng_tmpcnt).value & ")<br>" & vbcrlf
                                end if
                            next 
                        case 3
                            for lng_tmpcnt=0 to obj_Recordset3.Fields(FieldNumber).Properties.count-1
                                if lng_tmpcnt <> 15 and lng_tmpcnt <> 17 then
                                    GetField = GetField & lng_tmpcnt & " (" & obj_Recordset3.Fields(FieldNumber).Properties(lng_tmpcnt).name & "(" & obj_Recordset3.Fields(FieldNumber).Properties(lng_tmpcnt).type & ")= " & obj_Recordset3.Fields(FieldNumber).Properties(lng_tmpcnt).value & ")<br>" & vbcrlf
                                end if
                            next 
                        case else
                    end select
            end select
        end if
    end function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:58:31+00:00Added an answer on May 23, 2026 at 8:58 am

    This function takes the name of the SP and an array of parameters and returns a disconnected recordset

    Function RunSPReturnRS(strSP, params())
        On Error Resume next
    
        ''//Create the ADO objects
        Dim rs , cmd
        Set rs = server.createobject("ADODB.Recordset")
        Set cmd = server.createobject("ADODB.Command")
    
        ''//Init the ADO objects  & the stored proc parameters
        cmd.ActiveConnection = GetConnectionString()
        cmd.CommandText = strSP
        cmd.CommandType = adCmdStoredProc
        cmd.CommandTimeout = 900 ' 15 minutos
    
        collectParams cmd, params
    
        dim i 
        for i = 0 to ubound( Params )
          ''//Use: .CreateParameter("@inVar1", 200, 1, 255, VALUE1) to create the parameters
          cmd.Parameters.Append Params(i)
        next
    
    
        ''//Execute the query for readonly
        rs.CursorLocation = adUseClient
        rs.Open cmd, , adOpenForwardOnly, adLockReadOnly
    
        If err.number > 0 then
            exit function
        end if
    
        ''//Disconnect the recordset
        Set cmd.ActiveConnection = Nothing
        Set cmd = Nothing
        Set rs.ActiveConnection = Nothing
    
        ''//Return the resultant recordset
        Set RunSPReturnRS = rs
    
    End Function
    

    Or check this question for more info creating parameters Execute Stored Procedure from Classic ASP

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the below jquery code to call a ajax function in my
I have template function compare defined as below. #include<iostream> using namespace std; template<typename T>
I'm wondering how i can improve my Zend code that calls a stored procedure.
Based on this code below I use for regular mysql, how could I convert
I haven't solved this issue by using the stored procedure, yet we've decided to
Using CakePHP I'm getting multidimensional arrays and I can't seem to figure out why
Can someone look at my two functions below and suggest what I can do?
i want to implement next previous functionality using below function. - (void)motionEnded:(UIEventSubtype)mt withEvent:(UIEvent *)event
I am using the function below inside a thread to receive the byte[] via
I am using the function below to open the user's default web browser. Public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.