asp模糊搜索问题修改。
这里是现在的搜索代码,是连接mdb数据库的,现在模糊搜索不行,完整搜索就会显示出来,如何修改成模糊搜索也会显示对应的,帮忙在我这里原来的基础上可以修改嘛?Setrs=se...
这里是现在的搜索代码,是连接mdb数据库的,现在模糊搜索不行,完整搜索就会显示出来,如何修改成模糊搜索也会显示对应的,帮忙在我这里原来的基础上可以修改嘛?
Set rs = server.CreateObject("adodb.recordset")
if fl<>"" then
sql = "select * from users where email='"&fl&"'"
if request.Form("yh")<>"" then
sql = sql&" and email='"&request.Form("yh")&"'"
end if
sql = sql&" order by id desc"
else
sql = "select * from users"
if request.Form("yh")<>"" then
sql = sql&" where email='"&request.Form("yh")&"'"
end if
sql = sql&" order by id desc"
end if
rs.Open sql, conn, 1, 1
If rs.EOF Then 展开
Set rs = server.CreateObject("adodb.recordset")
if fl<>"" then
sql = "select * from users where email='"&fl&"'"
if request.Form("yh")<>"" then
sql = sql&" and email='"&request.Form("yh")&"'"
end if
sql = sql&" order by id desc"
else
sql = "select * from users"
if request.Form("yh")<>"" then
sql = sql&" where email='"&request.Form("yh")&"'"
end if
sql = sql&" order by id desc"
end if
rs.Open sql, conn, 1, 1
If rs.EOF Then 展开
1个回答
展开全部
Set rs = server.CreateObject("adodb.recordset")
dim sql
if fl<>"" then
sql="select * from users where email like '%"&fl&"%'"
if request.Form("yh")<>"" then sql&" and email like '%"&request.Form("yh")&"%'"
sql = sql&" order by id desc"
else
sql = "select * from users"
if request.Form("yh")<>"" then sql = sql&" where email like '%"&request.Form("yh")&"%'"
sql = sql&" order by id desc"
end if
rs.Open sql, conn, 1, 1
If rs.EOF Then
dim sql
if fl<>"" then
sql="select * from users where email like '%"&fl&"%'"
if request.Form("yh")<>"" then sql&" and email like '%"&request.Form("yh")&"%'"
sql = sql&" order by id desc"
else
sql = "select * from users"
if request.Form("yh")<>"" then sql = sql&" where email like '%"&request.Form("yh")&"%'"
sql = sql&" order by id desc"
end if
rs.Open sql, conn, 1, 1
If rs.EOF Then
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询