Wednesday, March 28, 2012

query problem

This don't work. I don't know why? Do you?
Thanks Mike

strSQL ="SELECT * FROM annons where lan=" & "'" &_
request.form("lanSelect") & "'" & " AND Rubrik Like" &_
"'%" & request.form("searchStr") & "%'" &_
" AND (registrerad BETWEEN " & FormatDateTime(DateAdd("d", -strTime,
date),bvShortDate) & _
" AND " & FormatDateTime(date,bvShortDate) & ")"Did you get any errors? How about,

strSQL = "SELECT * FROM annons WHERE lan = '" & Request.Form("lanselect") &
"' AND Rubrik LIKE '%' + " & Request.Form("searchstr") & " + '%' AND
registrerad BETWEEN '" & FormatDateTime(DateAdd("d", -strTime, date),
bvShortDate) & "' AND '" & FormatDateTime(date,bvShortDate) & "'"

Watch out for wrapping, single quotes etc.

--
- Anith
( Please reply to newsgroups only )

No comments:

Post a Comment