This topic is locked

Adding database last modified date

12/2/2004 1:28:43 AM
ASPRunnerPro General questions
author

I know it is not exactly related to asprunner functions, but maybe you can help.

I would like to display the database last modified date in all the _list.asp pages. can you please suggest how to do that?
Thanks

Admin 12/2/2004

Hi,
you can do something like this:

  1. Add a field named LastUpdated to the database table.
  2. Set "Edit as" type for this field to "Hidden" and set default value to Now(). This field will store the timestamp of this record update.
  3. On the list page use something like this to display database last updated date.
    set rsTemp = Server.CreateObject("ADODB.Recordset")

    rsTemp.Open "select max(LastUpdated) from TableName", dbConnection

    Response.Write rsTemp(0)

501113 12/2/2004

Many thanks for your response.

2 Issues:

  1. I have entered the following code in a <td></td> and it didn't show anything, also not the text "Last Modified:". Do you recognize any problem?

<%

set rsTemp = Server.CreateObject("ADODB.Recordset")

rsTemp.Open "select max(Last_Updated) from Customers", dbConnection

Response.Write "Last Modified:" + rsTemp(0)

%>


2. I had in the database a field updated by hand called "Last_Updated". I want that the field will be updated by itself. I didn't find where to set the "Edit as" type for this field to "Hidden". Can you please direct me?
Many thanks

Admin 12/5/2004

Make sure database connection is open at this moment and SQL query is correct (you can test itin MS Access).
EDIT AS type for this field can be set on the FORMATTING page in ASPRunnerPro.