Rossamino
asked on
How to reuse ado command parameter in a loop
I'm attempting to reassign the value of an ADO command parameter in a loop. How is that done? Here's what I've come up with that isn't working (note: we want to not find the trans_code in the database for it to be valid) :
if instr(1,x_transaction_code,",") then 'get the transaction code(s) into an array
arr_transaction_code = split(x_transaction_code,",")
else
arr_transaction_code(0) = x_transaction_code
end if
set sqlCommand = Server.CreateObject("adodb.command")
with sqlCommand
.ActiveConnection = conn
.CommandType = 1
.CommandTimeout = 30
.CommandText = "select top 1 AffTrackingParam from PromoOrder where AffTrackingParam = ?"
.Parameters.Append(.CreateParameter("@AffTrackingParam", db_varchar, input_param, 150)) 'no value is assigned here
end with
for Each i in arr_transaction_code
if len(i) = 20 or len(i) = 19 then
sqlCommand.Parameters("@AffTrackingParam").value = i 'update the parameter value from the tc array
set rs = sqlCommand.execute()
if rs.eof then
tcgood = true
end if
end if
rs.close
set rs = nothing
set sqlCommand = nothing
next
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER