asp中form表单里面的值传递是查询有一个可以查询 另一个却查不到
<%ifrequest.QueryString("act")="select"thendimselname,keywordssetrs=server.CreateObje...
<%if request.QueryString("act")="select" then
dim selname,keywords
set rs=server.CreateObject("adodb.recordset")
selname=request.Form("selname")
keywords=request.Form("keywords")%>
<%if keywords="" then
response.Write("<script language='javascript'>alert('请输入搜索内容!');javascript:history.go(-1);</script>")
response.End()
elseif selname="毕业证编号" then
sql="select * from card where graid='"&keywords&"'"%>
<%elseif selname="姓名" then
sql="select * from card where name='"&keywords&"'"
rs.open sql,conn,1,1
end if%>
<%end if%>
-----------------------------------------------------------------
<form method="post" name="search" action="cardsear.asp?act=select">
<select style="width:auto; text-align:center" size="1" name="selname">
<option value="姓名" selected="selected">姓名</option>
<option value="毕业证编号">毕业证编号</option>
</select>
<input type="text" size="20" name="keywords" />
<input type="submit" value="查询" />
</form>
---------------------------------------------------------------------
<%if request("act")="" then
response.Write("请输入条件进行查询!")%>
<%elseif rs.eof or rs.bof then
response.Write(selname)
response.Write("<script language='javascript'>alert('没有查到相关证书');javascript:history.go(-1)</script>")%>
<%else response.Write(selname)%>
<img src='<%=rs("UploadFiles")%>' />
<%end if%> 展开
dim selname,keywords
set rs=server.CreateObject("adodb.recordset")
selname=request.Form("selname")
keywords=request.Form("keywords")%>
<%if keywords="" then
response.Write("<script language='javascript'>alert('请输入搜索内容!');javascript:history.go(-1);</script>")
response.End()
elseif selname="毕业证编号" then
sql="select * from card where graid='"&keywords&"'"%>
<%elseif selname="姓名" then
sql="select * from card where name='"&keywords&"'"
rs.open sql,conn,1,1
end if%>
<%end if%>
-----------------------------------------------------------------
<form method="post" name="search" action="cardsear.asp?act=select">
<select style="width:auto; text-align:center" size="1" name="selname">
<option value="姓名" selected="selected">姓名</option>
<option value="毕业证编号">毕业证编号</option>
</select>
<input type="text" size="20" name="keywords" />
<input type="submit" value="查询" />
</form>
---------------------------------------------------------------------
<%if request("act")="" then
response.Write("请输入条件进行查询!")%>
<%elseif rs.eof or rs.bof then
response.Write(selname)
response.Write("<script language='javascript'>alert('没有查到相关证书');javascript:history.go(-1)</script>")%>
<%else response.Write(selname)%>
<img src='<%=rs("UploadFiles")%>' />
<%end if%> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询