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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using wildcard in ASP script (not SQL) 1

Status
Not open for further replies.

Aqif

Programmer
Apr 27, 2002
240
AU
Hi

I am new to ASP and thought that using wildcards will be easy in ASP but it turns out a bit different. Would anyone will be kind enough to point my logic to right direction

Code
----

For Each objItem In objFolder.Files

If objItem.Name = "*" & strSearch & "*" Then
Response.Write(ObjItem.Name & "-" & objFolder.Path & "<P>")
End If

Next

As obvious I am trying to compare the filename with all the files exisiting in a particular directory.

Thanks in advance

Cheers!
ÙÇãá

It's important to learn the rules so that you know how to break them.
 
Not sure about wildcards but you could always try using InStr()...
Code:
For Each objItem In objFolder.Files
    
  If InStr(objItem.Name, strSearch) Then
    Response.Write(objItem.Name & "-" & objFolder.Path & "<P>")
  End If

Next

Tony
________________________________________________________________________________
 
Thanks Tony

Worked Perfectly! very simple n effective logic



Cheers!
ÙÇãá

It's important to learn the rules so that you know how to break them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top