一个查询中错误,求助!
我想实现当输入会员名时,查询表格显示相应的记录,当页面载入时显示的是
lv_name= ' '时的内容,但当我输入会员名时,再按查询,显示的是空记录,数据库我看过有记录的,我把lv_name= ' "&strl& " ' "用lv_name= '张三 '时,查询正确的!是不是
if request.form( "active ")= "yes " then
strl=Request.QueryString(request.form( "text "))
sql = "Select * from news where lv_name= ' "&strl& " ' "有错误啊?
请教下!!!
代码部分:
-------------------------------
<%Set rs= Server.CreateObject ( "ADODB.Recordset ")
if request.form( "active ")= "yes " then
strl=Request.QueryString(request.form( "text "))
sql = "Select * from news where lv_name= ' "&strl& " ' "
else
sql = "Select * from news where lv_name= ' ' "
end if
rs.Open sql,db,1,3
%>
<form method= "post " action= " " name=form1>
<input name= "active " type= "hidden " id= "active " value= "yes ">
输入查询条件:会员名:
<input type= "text " name=text>
<input type= "submit " name=submit value=查询 >
<table> ..显示内容..
</table>
</form>
------解决方案--------------------把strl=Request.QueryString(request.form( "text "))改成 strl=request.form( "text "))应该可以了