G
Guest
I need advice on how to integrate the paging capbility to my search
script. The program I built requires me to make word search on several
db fields including one that's a memo type field, which doesn't work
with just a LIKE statement.
I was doing OK up till the part where I needed to page the results.
Here the code that I used (note that the code doesn't have paging
yet):
===== start code =====
' generate sql for search
if request.form("btnSubmit") = "Search" then
strTitle = request.form("fldTitle") 'subject field
strContent = lcase(request.form("fldContent")) 'news content field
'generate sql
strSqlsearch = "select * from News "
if strTitle <> "" then
strSqlsearch = strSqlsearch & "where Subject like '%" &
strTitle & "%' "
else
strSqlsearch = strSqlsearch & "and Subject like '%" &
strTitle & "%' "
end if
strSqlsearch = strSqlsearch & "order by id desc"
' run sql search
SQLstatement = strSqlsearch
set rs = conn.Execute(SQLstatement)
' get ready to display
if rs.eof then
' display not found msg
response.write "<p>No info matches your search.</p>"
else
' write out results
do while not rs.eof
' chg memo field to string
strContentrs = lcase(rs("Content"))
' check if contains keyword for content
if instr(strContentrs, strContent) > 0 then
response.write "some stuff to be written"
end if
rs.movenext
loop
end if
end if
===== end code =====
Again, could someone advise me how to go about paging this?
script. The program I built requires me to make word search on several
db fields including one that's a memo type field, which doesn't work
with just a LIKE statement.
I was doing OK up till the part where I needed to page the results.
Here the code that I used (note that the code doesn't have paging
yet):
===== start code =====
' generate sql for search
if request.form("btnSubmit") = "Search" then
strTitle = request.form("fldTitle") 'subject field
strContent = lcase(request.form("fldContent")) 'news content field
'generate sql
strSqlsearch = "select * from News "
if strTitle <> "" then
strSqlsearch = strSqlsearch & "where Subject like '%" &
strTitle & "%' "
else
strSqlsearch = strSqlsearch & "and Subject like '%" &
strTitle & "%' "
end if
strSqlsearch = strSqlsearch & "order by id desc"
' run sql search
SQLstatement = strSqlsearch
set rs = conn.Execute(SQLstatement)
' get ready to display
if rs.eof then
' display not found msg
response.write "<p>No info matches your search.</p>"
else
' write out results
do while not rs.eof
' chg memo field to string
strContentrs = lcase(rs("Content"))
' check if contains keyword for content
if instr(strContentrs, strContent) > 0 then
response.write "some stuff to be written"
end if
rs.movenext
loop
end if
end if
===== end code =====
Again, could someone advise me how to go about paging this?