[求助]还是查询的问题
在提交页面有7个文本框,输入数字进行查询,现在是一进入该页面,没有按下“查询”按钮就会自动出行一行数字,也就是数据库中的第一条记录。当按下查询“按钮”时,却会出错,请高手指点一下。我是越来越糊涂了。<!--#include file=conn.asp-->
<html><head><title>号码分析</title></head>
<body background=images\bg2.gif>
<form method=post action=fenxi.asp>
<center><font size=5 color=red face="方正舒体"> 输 入 号 码 进 行 分 析</font>
<p>看以住的期号是否有完全一致的号码!<p>
<table border=1 width=400>
<tr align=center>
<td colspan=6><font color=red>红 球</font>
<td><font color=blue>蓝 球</font>
<tr align=center>
<td><input type=text name=txt1 size=5>
<td><input type=text name=txt2 size=5>
<td><input type=text name=txt3 size=5>
<td><input type=text name=txt4 size=5>
<td><input type=text name=txt5 size=5>
<td><input type=text name=txt6 size=5>
<td><input type=text name=txt7 size=5>
</table>
<table width=400>
<tr align=center>
<td colspan=4><input type=submit name=submit1 value=提交>
<td colspan=3><input type=reset name=reset1 value=重填>
</table>
</form>
<%
a=request.form("txt1")
b=request.form("txt2")
c=request.form("txt3")
d=request.form("txt4")
e=request.form("txt5")
f=request.form("txt6")
g=request.form("txt7")
set rs=server.createobject("adodb.recordset")
sqlstr="select * from flcp1 "
if len(a)>1 and isnumeric(a) then
sqlstr=sqlstr & "and 红球1=" & a
end if
if len(b)>1 and isnumeric(b) then
sqlstr=sqlstr & "and 红球2=" & b
end if
if len(c)>1 and isnumeric(c) then
sqlstr=sqlstr & "and 红球3=" & c
end if
if len(d)>1 and isnumeric(d) then
sqlstr=sqlstr & "and 红球4=" & d
end if
if len(e)>1 and isnumeric(e) then
sqlstr=sqlstr & "and 红球5=" & e
end if
if len(f)>1 and isnumeric(f) then
sqlstr=sqlstr & "and 红球6=" & f
end if
if len(g)>1 and isnumeric(g) then
sqlstr=sqlstr & "and 蓝球=" & g
end if
rs.open sqlstr,myconn,1,3 '出错行
if rs.eof then
response.write "<script language=javascript> alert('没有想同的号码!') </script>"
else
response.write "<center><table border=1><tr>"
for i=0 to rs.fields.count-1
response.write "<td>" & rs.fields(i).value & " "
next
end if
%>