I am calling a function that returns the top N partnumbers.
Once I have the results, I want to take these partnumbers and enter them into another table. So far I have the following. I call the Stored Procedure successfully, but I need to enter the values into another table only if the stored procedure returns results. Can I store the results in an array to do so?
function getParts(startDate,endDate,Locations,rankBy,catClass,Vendor,topN,Company)
sql="TopParts"
'call the stored procedure and get the recordset
set command1 = server.CreateObject("ADODB.Command")
set command1.ActiveConnection = con
command1.CommandText = sql
command1.CommandType = adCmdStoredProc
command1.CommandTimeout = 2400
set param1 = command1.CreateParameter("startDate",adVarchar,adParamInput,10,Cstr(param1))
command1.Parameters.Append param1
set param2 = command1.CreateParameter("endDate",adVarchar,adParamInput,10,Cstr(param2))
command1.Parameters.Append param2
set param3 = command1.CreateParameter("Locations",adVarchar,adParamInput,1000,Cstr(param3))
command1.Parameters.Append param3
set param4 = command1.CreateParameter("rankBy",adVarchar,adParamInput,25,Cstr(param4))
command1.Parameters.Append param4
set param5= command1.CreateParameter("catClass",adChar,adParamInput,4,Cstr(param5))
command1.Parameters.Append param5
set param6= command1.CreateParameter("Vendor",adinteger,adParamInput,,Cint(param6))
command1.Parameters.Append param6
set param7= command1.CreateParameter("topN",adVarchar,adParamInput,4,Cstr(param7))
command1.Parameters.Append param7
set param8= command1.CreateParameter("Company",adChar,adParamInput,3,companyID)
command1.Parameters.Append param8
set rs = command1.Execute()
set command1.ActiveConnection = Nothing
set command1 = nothing
set param1 = nothing
set param2 = nothing
set param3 = nothing
set param4 = nothing
set param5 = nothing
set param6 = nothing
set param7 = nothing
set param8 = nothing
set getParts=rs
end function
'Call function
set rs=getParts(param1,param2,param3,param4,param5,param6,param7,param8)
**from here I want to store results in an array. Then, check to see if the array is empty, if not, take the values from the array and enter them into another table.
Thank you!!
Once I have the results, I want to take these partnumbers and enter them into another table. So far I have the following. I call the Stored Procedure successfully, but I need to enter the values into another table only if the stored procedure returns results. Can I store the results in an array to do so?
function getParts(startDate,endDate,Locations,rankBy,catClass,Vendor,topN,Company)
sql="TopParts"
'call the stored procedure and get the recordset
set command1 = server.CreateObject("ADODB.Command")
set command1.ActiveConnection = con
command1.CommandText = sql
command1.CommandType = adCmdStoredProc
command1.CommandTimeout = 2400
set param1 = command1.CreateParameter("startDate",adVarchar,adParamInput,10,Cstr(param1))
command1.Parameters.Append param1
set param2 = command1.CreateParameter("endDate",adVarchar,adParamInput,10,Cstr(param2))
command1.Parameters.Append param2
set param3 = command1.CreateParameter("Locations",adVarchar,adParamInput,1000,Cstr(param3))
command1.Parameters.Append param3
set param4 = command1.CreateParameter("rankBy",adVarchar,adParamInput,25,Cstr(param4))
command1.Parameters.Append param4
set param5= command1.CreateParameter("catClass",adChar,adParamInput,4,Cstr(param5))
command1.Parameters.Append param5
set param6= command1.CreateParameter("Vendor",adinteger,adParamInput,,Cint(param6))
command1.Parameters.Append param6
set param7= command1.CreateParameter("topN",adVarchar,adParamInput,4,Cstr(param7))
command1.Parameters.Append param7
set param8= command1.CreateParameter("Company",adChar,adParamInput,3,companyID)
command1.Parameters.Append param8
set rs = command1.Execute()
set command1.ActiveConnection = Nothing
set command1 = nothing
set param1 = nothing
set param2 = nothing
set param3 = nothing
set param4 = nothing
set param5 = nothing
set param6 = nothing
set param7 = nothing
set param8 = nothing
set getParts=rs
end function
'Call function
set rs=getParts(param1,param2,param3,param4,param5,param6,param7,param8)
**from here I want to store results in an array. Then, check to see if the array is empty, if not, take the values from the array and enter them into another table.
Thank you!!