Several methods for implementing asp to remind birthday with code

Source: Internet
Author: User

Asp birthday automatic reminder applet is written in ASP and debugged, easy to use-asp birthday automatically remind small programs with the preparation of ASP, debug, easy to use
Method 1:

I wrote a reminder program for my classmates in the last month. Although not very good, and very messy, but at least I think about it, so I pay more attention to it. Although there are many ASP programs that can be used for reference. But I think more often, we should be prominent in the classics. If we are innovative, we will not stick to the Conventions and never be able to become an ordinary programmer.

<%
Dim daydif
Dim days 'defines the number of days before and after the query for the birthday of the students. For example, 60 queries the list of students whose birthdays are from the previous month to the next month.
SQL = "Select name, brithday from class"
Set rs = server. CreateObject ("ADODB. RecordSet ")
Rs. Open SQL, con, 1, 1
For I = 1 to rs. recordcount 'read all data
If rs. eof then exit
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
%>

Method 2:
<%
Days1 = split (date (),"-")
Days2 = split (DateAdd ("d", 5, date ()),"-")
SQL = "select [id], Memberid, birthday from customers"
If days1 (1) <> days2 (1) then
SQL = SQL + "where (month (birthday) = '" & days1 (1) & "' or month (birthday) = '" & days2 (1 )&"')"
Else
SQL = SQL + "where month (birthday) = '" & days1 (1 )&"'"
End if
SQL = SQL + "and day (birthday) between'" & days1 (2) & "'and'" & days2 (2 )&"'"
'Response. Write (SQL)
Set conn = server. CreateObject ("ADODB. connection ")
Conn. open connstr
Set rsw.conn.exe cute (SQL)
If not rs. eof then %>
<Script language = "JavaScript">
Window. onload = getMsg;
Window. onresize = resizeDiv;
Window. onerror = function (){}
// SMS reminder (asilas added)
Var divTop, divLeft, divWidth, divHeight, docHeight, docWidth, objTimer, I = 0;
Function getMsg ()
{
Try {
DivTop = parseInt (document. getElementById ("eMeng"). style. top, 10)
DivLeft = parseInt (document. getElementById ("eMeng"). style. left, 10)
DivHeight = parseInt (document. getElementById ("eMeng"). offsetHeight, 10)
DivWidth = parseInt (document. getElementById ("eMeng"). offsetWidth, 10)
DocWidth = document. body. clientWidth;
DocHeight = document. body. clientHeight;
Document. getElementById ("eMeng"). style. top = parseInt (document. body. scrollTop, 10) + docHeight + 10; // divHeight
Document. getElementById ("eMeng"). style. left = parseInt (document. body. scrollLeft, 10) + docWidth-divWidth
Document. getElementById ("eMeng"). style. visibility = "visible"
ObjTimer = window. setInterval ("moveDiv ()", 10)
}
Catch (e ){}
}
Function resizeDiv ()
{
I + = 1
When (I> 500) closeDiv ()
Try {
DivHeight = parseInt (document. getElementById ("eMeng"). offsetHeight, 10)
DivWidth = parseInt (document. getElementById ("eMeng"). offsetWidth, 10)
DocWidth = document. body. clientWidth;
DocHeight = document. body. clientHeight;
Document. getElementById ("eMeng"). style. top = docHeight-divHeight + parseInt (document. body. scrollTop, 10)
Document. getElementById ("eMeng"). style. left = docWidth-divWidth + parseInt (document. body. scrollLeft, 10)
}
Catch (e ){}
}
Function moveDiv ()
{
Try
{
If (parseInt (document. getElementById ("eMeng"). style. top, 10) <= (docHeight-divHeight + parseInt (document. body. scrollTop, 10 )))
{
Window. clearInterval (objTimer)
ObjTimer = window. setInterval ("resizeDiv ()", 1)
}
DivTop = parseInt (document. getElementById ("eMeng"). style. top, 10)
Document. getElementById ("eMeng"). style. top = divTop-1
}
Catch (e ){}
}
Function closeDiv ()
{
Document. getElementById ('emeng'). style. visibility = 'den den ';
If (objTimer) window. clearInterval (objTimer)
}
</Script>
<DIV id = eMeng style = 'border-RIGHT: #455690 1px solid; BORDER-TOP: # a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: # a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: pixel PX; BACKGROUND-COLOR: # c9d3f3 '>
<TABLE style = 'border-TOP: # ffffff 1px solid; BORDER-LEFT: # ffffff 1px solid 'cellspacing = 0 cellPadding = 0 width = '000000' bgColor = # cfdef4 border = 0> <TBODY>
<TR>
<TD style = 'font-SIZE: 12px; BACKGROUND-IMAGE: url(msgTopBg.gif); COLOR: # 0f2c8c 'width = 30 height = 24> </TD>
<TD style = 'font-WEIGHT: normal; FONT-SIZE: 12px; BACKGROUND-IMAGE: url(msgTopBg.gif); COLOR: # 1f336b; PADDING-TOP: 4px; PADDING-left: 4px 'valign = center width = '000000'> birthday prompt: </TD>
<TD style = 'background-IMAGE: url(msgTopBg.gif); PADDING-TOP: 2px; PADDING-right: 2px 'valign = center align = right width = 19> <span title = close style = 'cursor: hand; color: red; font-size: 12px; font-weight: bold; margin-right: 4px; 'onclick = closeDiv ()> × </span> <! -- --> </TD>
</TR>
<TR>
<TD style = 'padding-RIGHT: 1px; BACKGROUND-IMAGE: url(1msgBottomBg.jpg); PADDING-BOTTOM: 1px 'colspan = 3 height = 90> <DIV style = 'border-RIGHT: # b9c9ef 1px solid; PADDING-RIGHT: 13px; BORDER-TOP: #728eb8 1px solid; PADDING-LEFT: 13px; FONT-SIZE: 12px; PADDING-BOTTOM: 13px; BORDER-LEFT: #728eb8 1px solid; WIDTH: 100%; COLOR: # 1f336b; PADDING-TOP: 18px; BORDER-BOTTOM: # b9c9ef 1px solid; HEIGHT: 100% '> Members who will have their birthdays in the near future: <BR> <DIV align = center style = 'word-break: break-all'>
<% 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> </TD>
</TR>
</TBODY>
</TABLE>
</DIV>
<% End if
Rs. close
Set rs = nothing
Conn. close ()
Set conn = nothing %>

Method 3:
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 MERs
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 MERs
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
%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.