asp实现数据库分类查找
1个回答
展开全部
<%
set rs=server.createobject("adodb.recordset")
sql="select * from admin where admin_name <>''and admin_pwd<>''"
if request("admin_name ")<>"" then sql=sql+" and admin_name ='"&request("admin_name ")&"'"
if request("admin_pwd")<>"" then sql=sql+" and admin_pwd='"&request("admin_pwd")&"'"
if request("admin_name")<>"" then sql=sql+" and admin_namelike '%"&Trim(request("admin_name"))&"%'"
sql=sql+" order by adddate desc"
rs.open sql,conn,1,1
%>
用这样的方法来读取数据库内的内容吧,你要查询某项时,你一定要给它一个东西啊.
就一定要用的IF语句...
set rs=server.createobject("adodb.recordset")
sql="select * from admin where admin_name <>''and admin_pwd<>''"
if request("admin_name ")<>"" then sql=sql+" and admin_name ='"&request("admin_name ")&"'"
if request("admin_pwd")<>"" then sql=sql+" and admin_pwd='"&request("admin_pwd")&"'"
if request("admin_name")<>"" then sql=sql+" and admin_namelike '%"&Trim(request("admin_name"))&"%'"
sql=sql+" order by adddate desc"
rs.open sql,conn,1,1
%>
用这样的方法来读取数据库内的内容吧,你要查询某项时,你一定要给它一个东西啊.
就一定要用的IF语句...
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询