[thelist] stuck in a loop (classic asp/mssql)

Ian Anderson ian at zstudio.co.uk
Mon Aug 22 11:45:26 CDT 2005

Joshua Olson wrote:

>This is no problem.  Consider changing the delimiter within the values of
>the checkboxes to something else, such as a ;.  Then, the ASP code would
>look something like this:

Or perhaps simpler to use the step option in the for loop?

Given the string:

"0001810160665071,MRF70TO73,MBC2, 0001850170665070,MRF70TO73,MBC2, 
000717033,LT_5077,MBC2, 000821090,OPT5171,MBC2"

which has been split into an array aryValues on the commas, all you have 
to do is step through it in threes:

for i = 0 to Ubound(aryValues) step 3
    strSQL = "update " & aryValues(i+2) & ".dbo.Database." & 
aryValues(i+1) &" set status = 'U' where rowid = '" & aryValues(i) & "'" "
    ...execute the sql...
As long as you are sure you have all three values for each item in the 
structured string to start with, then this should also work, surely?



More information about the thelist mailing list