[thelist] CDONTS and looping through an array
darren
darren at web-bitch.co.uk
Thu Aug 29 06:34:01 CDT 2002
On Wednesday, August 28, 2002 at 20:56, Ingrid Z wrote:
<snip>
IZ> Problem is, I want the email generated from the page to 'nicely'
IZ> display the list, as well as general information. So my question is
IZ> this - Should I use an array to capture the Page Names, then loop
IZ> through it again in my CDONTS subject?
i like arrays, so i'd say yes.
but you can greatly enhance this part...
IZ> 'loop through the results, and put the names in an array
IZ> Dim holder(20)
IZ> i = 0
IZ> DO WHILE NOT rstemp.eof
IZ> holder(i) = rstemp("LinkName")
IZ> i = i + 1
IZ> rstemp.MoveNext
IZ> Loop
by simply doing:
if not (rsTemp.EOF or rsTemp.BOF) then
holder = rsTemp.GetRows
else
' you have no records
end if
you now have a 2d array with the link name in the second column. you could
also use this to get your count with:
numberOfPages = ubound(holder(1)) + 1
you need to add one as the array is zero-based, which would save a database
hit.
to build the string for the email you could have something like:
const PageName = 1
for i = 0 to ubound(holder(1))
emailBody = emailBody & " " & holder(i, PageName) & vbCRLF
next
hth,
darren
More information about the thelist
mailing list