hi,
thanks for the reply.
yes, i've used the rs.EOF or rs.BOF for checking whether there's any record returned or not. and i get "There's No news".
here's the declaration of the connection and rs object
-
<%
-
'file for database connection
-
set conn = server.CreateObject("ADODB.Connection")
-
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("../db.mdb")
-
-
set rs = Server.CreateObject("ADODB.Recordset")
-
rs.CursorLocation = 3
-
%>
-
and this is the query code
-
<%
-
'get news
-
if search <> "" then
-
if modeSearch = "title" then
-
'if search news based on title
-
rs.open "select * from msNews where title like '*"&search&"*'", conn
-
else
-
'search news based on meat
-
rs.open "select * from msNews where meat like '*"&search&"*'", conn
-
end if
-
else
-
rs.open "select * from msNews", conn
-
end if
-
%>
-
here's the result displaying code
-
<%
-
'rs checking
-
if not (rs.BOF or rs.EOF) then
-
do while Not ( rs.Eof or rs.AbsolutePage <> page )
-
%>
-
-
<!-- render news in html -->
-
-
<%
-
rs.moveNext
-
Loop
-
else
-
response.write("There's no News")
-
end if
-
%>
-
it works find if the user doesn't search anything, all of the news are returned.
but i get "There's no News" when i search for some news that are exist in the database. what makes me wonder is that when i query the table directly from Ms Access 2007 using the same keyword that i've tried from the page, i get some records.
i don't know what possibly is wrong.
Thank you.
SC.