Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loop thru to not find anything 1

Status
Not open for further replies.

onressy

Programmer
Mar 7, 2006
421
CA
Hi, in a table column "ChildProperties" the value is:
314|355|854|111

Dim Vid : Vid = Request.QueryString("id")

' let say Vid is 444, I would like to determine if 444 is in the CParr array:

If NOT RS.EOF Then
Dim CParr,j : CParr = Split(RS("ChildProperties"), "|")

For j = 0 to Ubound(CParr)

'Now i'm looping thru the array,
'how can i do something if Vid does not
'match any of the array values? Thanks

Next
End If
 
Code:
If NOT RS.EOF Then
   Dim CParr,j : CParr = Split(RS("ChildProperties"), "|")
[!]   Dim bFound
   bFound = False[/!]

    For j = 0 to Ubound(CParr)

             'Now i'm looping thru the array, 
             'how can i do something if Vid does not 
             'match any of the array values? Thanks
[!]      If cParr(j) = "444" Then
         bFound = True
      End If[/!]
    Next

[!]    If bFound = False Then
      ' Do something here
    Else
      ' Do something else
    End If[/!]
End If

Another Way....

Code:
If Instr("|" & RS("ChildProperties") & "|", "|444|") = 0 Then
  Response.Write("444 Not in the string")
Else
  Response.Write("444 is in the string.")
End If

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Le Autre way is almost paper thin! Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top