日期:2014-05-17  浏览次数:20800 次

ASP产品搜索代码疑问
产品搜索表单:
HTML code
<script language=javascript>
<!--
function CheckForm()
{
 if(document.form1.cpkey.value=="")
 {
  alert("请输入你要查询的关键词!");
  document.form1.cpkey.focus();
  return false;
 }
}
//-->
</script>

<form name="form1" method="post" action="search.asp" onSubmit="return CheckForm();">
          <table width="190" height="60" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td width="70">输入关键字</td>
              <td><input name="name" type="text" id="name" size="15"></td>
            </tr>
            <tr align="center" valign="middle">
              <td colspan="2"><input type="submit" name="Submit" value="点击搜索"></td>
              </tr>
          </table></form>


搜索查询页面:
HTML code
<!-- #include file="Inc/Conn.asp" -->
<!-- #include file="Head.asp" -->
<%
cpkey=request.form("name") '获取关键词
sqlpic="select * from Photo where cpkey='"&name&"'"
set rspic=server.createobject("adodb.recordset")
rspic.open sqlpic,conn,1,1
%>

              <table width=668 border=0 align="center" cellpadding=0 cellspacing=0 style="margin-top:5px;">
                <tr>
                  <td align=left valign="top">
<%
do while not rspic.eof
%>
<table width="150" height="22" border="0" align="left" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="130" height="20" align="center" valign="middle" bgcolor="#FFFFFF"><a href="View.asp?id=<%=rs("id")%>"><%=Left(rs("name"), 22)%></a></td>
                    </tr>
                  </table>
<% 
rspic.MoveNext
Loop
%>                </tr>
              </table>


---------------------
想要搜索ACCESS数据库中Photo表中的name,测试出现下面的错误,请问这代码是哪写错了,还是别的问题?谢谢!

Microsoft JET Database Engine 错误 '80040e10' 

至少一个参数没有被指定值。 

/Toupiao/search.asp,行 7

------解决方案--------------------
第一,脚本出错
JScript code
//document.form1.cpkey.focus();
  document.form1.name.focus();