Groups | Blog | Home
all groups > inetserver asp db > february 2006 >

inetserver asp db : passing wildcard criteria


Wendy Parry
2/12/2006 12:06:47 PM
Hi,
I'm having a little trouble using the SQL LIKE clause with asp.net to an
Access Database...

Dim strSQL as String = "SELECT * FROM tblDickerExtensions WHERE Surname
" & " LIKE " & criteria & "*"

I just can't get the " & ' syntax correct, I'm sure it's a 2 second
thing for you guys...

Evertjan.
2/12/2006 12:20:59 PM
Wendy Parry wrote on 12 feb 2006 in microsoft.public.inetserver.asp.db:

[quoted text, click to view]

"as String"
not in asp-vbs

" & criteria & "*"
must be quoted

Dim strSQL,criteria
criterium = "bl?h*"
strSQL = "SELECT * FROM tblX WHERE Sn LIKE '" & criterium & "'"



--
Evertjan.
The Netherlands.
Roger Hembury
2/12/2006 12:30:01 PM

[quoted text, click to view]

Try changing it to

Dim strSQL as string = "SELECT * FROM tblDickerExtensions WHERE Surname LIKE
'%" & criteria & "%'"

Note the single quote ' before and after the %

Don't know if this will work in asp.net but it works with classic asp

Roger

Wendy Parry
2/12/2006 12:42:00 PM
[quoted text, click to view]
AddThis Social Bookmark Button