2D arrays...

1. Senior Member
Join Date
Dec 1969
Posts
227

## 2D arrays...

More on a problem raised earlier...<BR><BR>I have a 2D array that I generate using GetRows().<BR><BR>But there is only one column in it. Does that mean it is a 1D array?<BR><BR>If not can I refer to individual values like this...<BR><BR>If aArrayFromDB(0,i) =...<BR>(assuming the loop is set up)?<BR><BR>If not - then how do I refer to them?

2. Senior Member
Join Date
Dec 1969
Posts
96,118

## GetRows *always* gives 2D array...

...even if only one column.<BR><BR>Yes, that&#039;s how you&#039;ll need to refer to the values.<BR><BR>Why didn&#039;t you just *try* it???

3. Join Date
Dec 1969
Posts
90

## try this

havent tested, but should baerly work :p<BR><BR>Dim NewArr<BR>Redim NewArr(0,100) &#039;you need to set this higher then max records / or do a ReDim Preserv NewArr(0,uBound(NewArr,2) + 100)<BR><BR>y = -1<BR>For i=0 to uBound(aArrayFromDB,2) <BR> error = ""<BR> For j = 0 to uBound(aCandIDs,2) <BR> If aArrayFromDB(0,i) = aCandIDs(0,j) then <BR> error = "found value"<BR> End If <BR> Next <BR> If error = "" then<BR> y = y + 1<BR> NewArr(0,y) = aArrayFromDB(0,i)<BR> End If<BR>Next

4. Senior Member
Join Date
Dec 1969
Posts
96,118

## TRIPLE YUCK!

If you want to avoid duplicate values, then do that in the SQL QUERY, not in an ugly nested loop like that!<BR><BR>SQL = "SELECT DISTINCT whatever FROM someplace WHERE something ORDER BY whatever"<BR><BR>

5. Senior Member
Join Date
Dec 1969
Posts
96,118

## I also replied...

...now, in SnowGoose&#039;s other thread, below.<BR><BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•