index.asp
<form action="check.asp" method="post">
学号:<input type="text" name="number">
<input type="submit" value="提交" name="1">
<input type="hidden" value="1" name="sub_type">
</form>
<br>
<form action="check.asp" method="post">
姓名:<input type="text" name="stuname">
<input type="submit" value="提交" name="2">
<input type="hidden" value="2" name="sub_type">
</form>
<br>
check.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<%
dim dd
dim stuID
dim add
dim sname
addr=trim(request("address"))
stuID=trim(request("number"))
sname=trim(request("stuname"))
homep=trim(request("homephone"))
name=cint(trim(request("sub_type")))
Set con=Server.CreateObject("ADODB.Connection")
dd=Server.MapPath("stu.mdb")
con.open "driver={Microsoft Access Driver (*.mdb)};dbq="&dd
set rs=server.createobject("adodb.recordset")
select case(name)
case 1
sql="select * from student where 学号 like '%"&stuID&"%'"
Set rs=con.Execute(sql)
case 2
sql="select * from student where 姓名 like '%"&sname&"%'"
Set rs=con.Execute(sql)
case 3
sql="select * from student where 家庭电话 like '%"&homep&"%'"
Set rs=con.Execute(sql)
case 4
sql="select * from student where 家庭地址 like '%"&addr&"%'"
Set rs=con.Execute(sql)
end select
response.write"<table border=1>"
response.write"</tr>"
for i=0 to rs.Fields.count-1
response.write"<td>"& rs.fields(i).name & "</td>"
next
response.write"</tr>"
do while not rs.EOF
response.write"</tr>"
for i=0 to rs.fields.count-1
response.write"<td>"& rs.fields(i).value & "</td>"
next
rs.movenext
response.write"</tr>"
loop
response.write"</table>"
set con=nothing
%>
</body>
</html>
我在表单里没有输入任何东西,我按提交的时候。。在check.asp里也会显示数据库里的东西。。
请大侠帮个忙。。要在check.asp里怎么判断。。才不会出这样的错
求助````