asp 模糊查询问题 10
表单部分<formaction="news.asp"method="post"name="search"><inputclass="input1"value=""id="...
表单部分
<form action="news.asp" method="post" name="search">
<input class="input1" value="" id="myinput" type="text" name="kword" />
<input type="submit" class="button1" value="" />
</form>
news.asp代码部分
kword=request.form("kword")
set rs=server.createobject("adodb.recordset")
if kword<>""then
exec="select * from news where title like '%"&kword&"%'"
end if
rs.open exec,conn,1,1
没法模糊查询 在线求救 展开
<form action="news.asp" method="post" name="search">
<input class="input1" value="" id="myinput" type="text" name="kword" />
<input type="submit" class="button1" value="" />
</form>
news.asp代码部分
kword=request.form("kword")
set rs=server.createobject("adodb.recordset")
if kword<>""then
exec="select * from news where title like '%"&kword&"%'"
end if
rs.open exec,conn,1,1
没法模糊查询 在线求救 展开
2个回答
展开全部
kword=request.form("kword")
set rs=server.createobject("adodb.recordset")
exec = "select * from news"
if kword<>""then
exec = exec&" where title like '%"&kword&"%' "
end if
rs.open exec,conn,1,1
if rs.eof then
Response.write "未找到相应内容"
Else
'这里是你的代码
end if
set rs=server.createobject("adodb.recordset")
exec = "select * from news"
if kword<>""then
exec = exec&" where title like '%"&kword&"%' "
end if
rs.open exec,conn,1,1
if rs.eof then
Response.write "未找到相应内容"
Else
'这里是你的代码
end if
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询