asp实现的可以提醒生日的几种方法附代码(4)


<%i=1
do while not rs.eof
Response.Write("<a href='/System/AdmMember/Edit.asp?id="&rs(0)&"' title=''><font color='red'>"&rs(1)&"</font></a>("&month(rs(2))&"-"&day(rs(2))&")  ")
if i mod 2 =0 then response.Write("</br>")
rs.movenext
i=i+1
loop%></DIV></DIV> </TD>
</TR> 
</TBODY> 
</TABLE> 
</DIV> 
<% end if
rs.close
set rs=nothing 
conn.close()
set conn=nothing %> 

 
方法三:
sql server:
<%
If month(Now())=12 and day(now())>24 Then
sSql = "select FoodID, Strname, TimeID from Tfood where ( datediff(d,getdate(),dateadd(year,datediff(Year,TimeID,GetDate()),TimeID))<=200 and datediff(d,getdate(),dateadd(year,datediff(Year,TimeID,GetDate()),TimeID))>=0 ) Or ( datediff(d,getdate(),dateadd(year,datediff(Year,TimeID,GetDate())+1,TimeID))<=200 and datediff(d,getdate(),dateadd(year,datediff(Year,TimeID,GetDate())+1,TimeID))>=0 )"
Else
sSql = "select FoodID, Strname, TimeID from Tfood where ( datediff(d,getdate(),dateadd(year,datediff(Year,TimeID,GetDate()),TimeID))<=200 and datediff(d,getdate(),dateadd(year,datediff(Year,TimeID,GetDate()),TimeID))>=0 )"
End If
%>
Access:
<%
If month(Now())=12 and day(now())>24 Then
    sSql = "SELECT *
FROM customers
WHERE ( datediff('d',date(),dateadd('yyyy',datediff('yyyy',Birthday,date()),Birthday))<=5 and datediff('d',date(),dateadd('yyyy',datediff('yyyy',Birthday,date()),Birthday))>=0 ) Or ( datediff('d',date(),dateadd('yyyy',datediff('yyyy',Birthday,date())+1,Birthday))<=5 and datediff('d',date(),dateadd('yyyy',datediff('yyyy',Birthday,date())+1,Birthday))>=0 );"
    Else
     sSql = "SELECT *
FROM customers
WHERE (DateDiff('d',date(),DateAdd('yyyy',DateDiff('yyyy',[Birthday],date()),[Birthday]))<=5 And DateDiff('d',date(),DateAdd('yyyy',DateDiff('yyyy',[Birthday],date()),[Birthday]))>=0);"
End If
%>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/2611.html