试试这个,如果是SQL数据库请把 # 改为 '
培训成绩应是数字型的,所以 S2 的左右的 '去掉.
<%
dim s1,s2,s3,sql,rs
s1= Trim(Request("培训学生"))
s2= Trim(Request("培训成绩"))
s3= Trim(Request("培训时间"))
if s1="" then s1=Trim(Request("s1"))
if s2="" then s2= Trim(Request("s2"))
if s3="" then s3=Trim(Request("s3"))
sql="select * from student"
if s1<>"" and s2<>"" and s3<>"" then
sql=sql & " where s_student='"&s1&"' and s_result="&s2&" and s_time=#"&s3&"#"
end if
if s1<>"" and s2 <> "" and s3="" then
sql=sql & " where s_student='"&s1&"' and s_result="&s2&" "
end if
if s1<>"" and s2 = "" and s3="" then
sql=sql & " where s_student='"&s1&"'"
end if
if s1="" and s2 <> "" and s3<>"" then
sql=sql & " where s_result="&s2&" and s_time=#"&s3&"#"
end if
if s1="" and s2 = "" and s3<>"" then
sql=sql & " where s_time=#"&s3&"#"
end if
if s1<>"" and s2 = "" and s3<>"" then
sql=sql & " where s_student='"&s1&"' and s_time=#"&s3&"#"
end if
if s1="" and s2 <> "" and s3="" then
sql=sql & " where s_result="&s2&""
end if
set rs=server.createobject("adodb.recordset")
Response.write sql
rs.open sql,conn,1,3
rs.pagesize=3
page=request("page")
if page="" then page=1
if cint(page)<="0" then page=1
if cint(page)>rs.pagecount then page=rs.pagecount
if not rs.eof then rs.absolutepage=cint(page)
%>
按姓名查询结果如下: | ||||
序列 | 培训学生 | 培训成绩 | 培训老师 | 培训时间 |
<%=(rs.Fields.Item("编号").Value)%> | <%=(rs.Fields.Item("培训学生").Value)%> | <%=(rs.Fields.Item("培训成绩").Value)%> | <%=(rs.Fields.Item("培训老师").Value)%> | <%=(rs.Fields.Item("培训时间").Value)%> |
上一页 | <%response.write("记录总数:"&rs.RecordCount)%> | 下一页 |