Hi! I want to show Upcoming Birthday with name, location from my MSSQL table empmaster.
My SQL code is
SELECT TOP 10 DOB, name, username
FROM empmaster
WHERE DATEPART(mm,DOB) = DATEPART(mm,GETDATE())
AND DATEPART(day,DOB) >= DATEPART(day,getdate())
OR DATEPART(mm,DOB) = DATEPART(mm,getdate())
ORDER BY DatePart(mm,DOB),DatePart(day,DOB)
My Asp.Net Code is:
<div class="aspgrid">
<asp:GridView ID="Birthday_grid" runat="server" RowStyle Wrap="false"
DataSourceID="SqlDataSource3" GridLines="Horizontal" >
<AlternatingRowStyle Wrap="False" />
<RowStyle Wrap="False"></RowStyle>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:SQLDbConnection %>"
SelectCommand="SELECT TOP 10 DOB, name, username, department, location FROM empmaster WHERE DATEPART(mm,DOB) = DATEPART(mm,GETDATE()) AND DATEPART(day,DOB) >= DATEPART(day,getdate()) OR DATEPART(mm,DOB) = DATEPART(mm,getdate()) ORDER BY DatePart(mm,DOB),DatePart(day,DOB)"/>
</div>
Can Any Body help me to show upcoming Birthday of the month.