sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
David P. Jessup's Avatar

Populating my array


Question posted by: David P. Jessup (Guest) on July 19th, 2005 09:22 AM
Background info:
I'm attempting to populate an array with specific column numbers from a
database. I have another array(from a linked table) that has matching
column names from the original database.

CODE:
LinkCount=0
ClmCount=0
for each ofield in rs.fields
response.write "<th>" & ofield.name & "</th>"
if ofield.name = strLinkedColumn(LinkCount) Then
redim preserve eClmCount(LinkCount)
eClmCount(Linkcount) = ClmCount
LinkCount=LinkCount+1
end if
ClmCount=ClmCount+1
next

strLinkedColumn is an array that contains the column names
eClmCount will be an array that should be populated with the column number
based on matching column names

My problem is that after the last matching strLinkedColumn = ofield.name and
my for each loops into any other fields, my eClmCount array is still being
populated.

example:
DB columns a,b,c,d,e,f,g
strLinkedColumn(0=c)
strLinkedColumn(1=d)

Running through my for each eClmCount would first get populated with 2, then
3 and I would expect it to stop there, but array continues to build but with
empty values so if I loop through strLinkedColumn in the above example with
a response.write "eClmCount: " & eClmCount & "<br>" this is the output I
get:

eClmCount: 2
eClmCount: 3
eClmCount:
eClmCount:
eClmCount:

I hope I didn't make this to verbose, but I hope I explained what my problem
is too =)
--
Thanks from this ASP Newbie


0 Answers Posted
 
Not the answer you were looking for? Post your question . . .
197,013 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 197,013 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors