<% dim daydif dim days '定义查询前后多少天内生日的同学,如60则查询前一个月后下一个月生日的同学名单。 SQL="Select name,brithday from class " Set rs=server.CreateObject("ADODB.RecordSet") rs.Open SQL,con,1,1 for i=1 to rs.recordcount '读出所有的数据 if rs.eof then exit for daydif=abs(datediff("d",date,rs("birthday")) )mod 365 if daydif < days response.write rs("name")%> response.write "<font color="#FF0000">" response.write rs("birthday")&"、</font>" end if rs.movenext loop rs.Close Set rs=nothing