Thread: Time?

  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Aug 2004
    Rep Power


    Hi, I am trying to record the time when a certain value in the table is updated for
    example when the UPDATE runs it sets the value of a certain field and then I want it to
    record the current time in another designated field in the Access database.

    I thought I'd try the following but it doesnt work:

    sqlstmte ="UPDATE LoneWorkerData SET "
    sqlstmte = sqlstmte & "UpdateTime=" & time
    sqlstmte = sqlstmte & " WHERE MSISDN=" & Request.Cookies("msisdn")
    sqlstmt = sqlstmt & " AND USERNAME=" & Request.Cookies("username")
    conn.execute (SQLstmte)

    Then when I display the record on a webpage I want it to take the time the update occurred and if the update occurred more than 30mins before the current time I want it to display a certain image (red.gif) but if the update occurrec less than 30mins before the current time I want it to display a different image (blue.gif)

    The Display code is below but I don't know how to add the time and image display stuff, I was thinking maybe I'd write:

    "if rs("Status")=0 AND (not sure this is right) UpdateTime>time()-30 then response.write etc. but I don't think this is right

    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open SQLQuery, conn, 3, 3
    Set rs=conn.execute(SQLQuery)

    do until rs.eof
    if rs("Status")=0 then response.write("<TR><TD>" & rs("MSISDN") & "</TD><TD></TD><TD>" & "<IMG SRC='black.gif'>" & "</TD><TD></TD><TD>" & rs("Forename") & "</TD><TD></TD><TD>" & rs("Surname") & "</TD></TR>")
  2. #2
  3. No Profile Picture
    Grumpier Old Moderator
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2003
    Rep Power
    Most dbms need a delimiter around time values in a sql statement. MS Access uses # and most other dbms use '

    sqlstmte = sqlstmte & "UpdateTime=#" & time & "#" 'Access example
    Doug G
    I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Similar Threads

  1. Start time / End time calculation
    By GaryN in forum Microsoft Access Help
    Replies: 13
    Last Post: January 5th, 2004, 02:30 PM
  2. Date and time
    By thehen in forum Programming Help
    Replies: 0
    Last Post: October 16th, 2003, 02:17 AM
  3. Is there a way to add Properties at run time
    By Sathish in forum .NET Development
    Replies: 0
    Last Post: February 4th, 2003, 05:26 PM
  4. Need help with displaying time format
    By Steve Schofield in forum ASP Development
    Replies: 0
    Last Post: April 10th, 2002, 11:13 PM

IMN logo majestic logo threadwatch logo seochat tools logo