...

View Full Version : How to pickup latest date from database



Squall Leonhart
11-21-2003, 06:51 PM
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?

Roelf
11-21-2003, 07:05 PM
select max(date) from .....

Roy Sinclair
11-21-2003, 07:09 PM
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 :p.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum