Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Nov 2003
    Location
    Canada
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to pickup latest date from database

    Hi, guys.

    Do you know how to pick up latest date from database?
    Please take a look at following code.



    code:--------------------------------------------------------------------------------
    <HTML>
    <HEAD>
    </HEAD>
    <BODY LEFTMARGIN=0 MARGINWIDTH="0" MARGINHEIGHT="0">
    <%
    Dim adoCon
    Dim rsRequest
    Dim strSQL
    Set adoCon = Server.CreateObject("ADODB.Connection")
    Set rsRequest = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT date FROM tblRequest"
    adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("tech_re.mdb")
    rsRequest.CursorType = 3
    rsRequest.Open strSQL, adoCon
    %>
    <table width=100% topmargin=0>
    <TR valign=top>
    <TD colspan=2 align=center ><FONT FACE=Arial,Helvetica SIZE=2 color=blue><B>TOP 10 IT HOTLIST</b></font></td>
    </tr>
    <TR>
    <TD colspan=2 align=center WIDTH=300><FONT FACE=Arial,Helvetica SIZE=-1 color=blue><i>Last modified:<%=rsRequest("date")%> </i></font></td>
    </tr>
    <tr>
    <TD WIDTH="300" ALIGN=LEFT><FONT FACE=Arial,Helvetica SIZE=-1 color=red><B> <a href="ITHotlist.xls" target=new>All IT Projects...</a></B></FONT></TD>
    </TR>
    </table>
    <%'Reset server objects
    rsRequest.Close
    Set rsRequest = Nothing
    Set adoCon = Nothing
    %>

    </BODY>
    </HTML>
    --------------------------------------------------------------------------------


    It's not picking up newest time. It's only picking up first one.
    So what can I do?

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    select max(date) from .....
    I am the luckiest man in the world

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    SELECT Max(date) FROM tblRequest -- Is how I'd do that.

    Edit: Got distracted by an article that came in my email so Roelf beat me to it .


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •