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

Need Wildcard to work in Replace 2

Status
Not open for further replies.

thunderain

Programmer
Jan 10, 2002
40
0
0
CA
Hello:

I am using ASP with vbScript. I have an search sql statement using "like", "not like" and "fuzzy match" that I need to send through a link. When i send it through a link, it loses it's % characters on the receiving page. Using replace, i am trying to replace the % characters in the sql statement. The entire sql statement is quite lengthy and i only need to show a portion to show what is happening.

Portion of original sql statement:

(EntryLP like '%M%[5S]%F%9%') OR (EntryLP like '%M%[5S]%F%9%[B8]%'))

When i pass it through a link, it loses it's %'s and looks like this:

(EntryLP like 'M[5S]F9') OR (EntryLP like 'M[5S]F9[B8]'))

I am trying to use Replace to put them back in, using wildcards. I have read that % is a wild card but I can't seem to get it working. I don't think I am using it quite correctly. I have tried several ways but here is closest one i figure should work but doesn't.

strSQL = Replace(strSQL,"like '"%%%%%%"'", "like '%"%"%"%"%"%"%"%"%"%"%"%"%"%"%'")

It is particularly hard when the wildcard and the character i'm trying to put in are the same (%).

If anyone can help it would be gratefully appreciated.

Thanx
thunderain
 
Can't u use "Server.HTMLEncode", or use the number code for "%" sign, which is %

?


Min.
 
Response.Write(Server.UrlEncode("your text and %% "))

this will encode the percents, the put them back to normal on the next page. www.vzio.com
ASP WEB DEVELOPMENT



 
strSQL = Server.URLencode(strSQL)

Handy tip guys, it was just what i needed.

I ripped out all of the lines using replace in my other searches and used this!!!!!

thanx
thunderain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top