<%
if Request.Form("Submit")="搜索" then '如果用户进行了搜索或者重新进行了搜索
'构造搜索的SQL语句
if Request("stuname")="yes" then '检测姓名是否被选中
stu_name=check(Request("stu_name"))
if Request("stu_name")="" then
Response.Write("<script language=javascript>alert('错误!按名称搜索时名称不能为空!')</script>")
Response.Write("<script language=javascript>window.location='admin_charge.asp'</script>")
Response.End()
else
if Request.Form("name_like")="like" then
stuname_sql=" stu_name like '%"&stu_name&"%' and"
else
stuname_sql=" stu_name='"&stu_name&"' and"
end if
end if
else
stuname_sql=""
end if
if Request("stusex")="yes" then '检测性别是否被选中
stu_sex=check(Request("stu_sex"))
stusex_sql=" stu_sex='"&stu_sex&"' and"
else
stusex_sql=""
end if
if Request("stuaddtime")="yes" then '检测入学时间是否被选中
stu_addtime=check(Request("stu_addtime"))
if stu_addtime="请选择" then
Response.Write("<script language=javascript>alert('错误!按入学时间搜索时入学时间不能为空!')</script>")
Response.Write("<script language=javascript>window.location='admin_charge.asp'</script>")
Response.End()
end if
stuaddtime_sql=" stu_addtime='"&stu_addtime&"' and"
else
stuaddtime_sql=""
end if
if Request("stuclass")="yes" then '检测班级是否被选中
stu_class=check(Request("stu_class"))
if stu_class="请选择" then
Response.Write("<script language=javascript>alert('错误!按班级搜索时班级不能为空!')</script>")
Response.Write("<script language=javascript>window.location='admin_charge.asp'</script>")
Response.End()
end if
stuclass_sql=" stu_class='"&stu_class&"' and"
else
stuclass_sql=""
end if
if Request("stulearnid")="yes" then
stu_learnid=check(Request("stu_learnid"))
if stu_learnid="" then
Response.Write("<script language=javascript>alert('错误!按学号搜索时学号不能为空!')</script>")
Response.Write("<script language=javascript>window.location='admin_charge.asp'</script>")
Response.End()
else
if Request("learnid_like")="like" then
stulearnid_sql=" stu_learnid like '%"&stu_learnid&"%' and"
else
stulearnid_sql=" stu_learnid='"&stu_learnid&"' and"
end if
end if
else
stulearnid_sql=""
end if
if Request("stuidnum")="yes" then
stu_idnum=check(Request("stu_idnum"))
if stu_idnum="" then
Response.Write("<script language=javascript>alert('错误!按身份证搜索时身份证不能为空!')</script>")
Response.Write("<script language=javascript>window.location='admin_charge.asp'</script>")
Response.End()
else
if Request("idnum")="like" then
stuidnum_sql=" stu_idnum like '%"&stu_idnum&"%' and"
else
stuidnum_sql=" stu_idnum='"&stu_idnum&"' and"
end if
end if
else
stuidnum_sql=""
end if
if Request("stustart")="yes" then '检测学生是否初始化是否被选中
stu_start=check(Request("stu_start"))
stustart_sql=" stu_start='"&stu_start&"' and"
else
stustart_sql=""
end if
sql="select * from information where"&stuname_sql&stusex_sql&stuaddtime_sql&stuclass_sql&stulearnid_sql&stuidnum_sql&stustart_sql&" 1=1 order by stu_id desc"
session("sql")=sql
'Response.Write(sql)
end if
if session("sql")="" then
sql="select * from information order by stu_id desc"
session("sql")=sql
end if
%>