Calculate Times with ASP.Net/SQL

Results 1 to 2 of 2

Thread: Calculate Times with ASP.Net/SQL

  1. #1
    Join Date
    Dec 1969

    Default Calculate Times with ASP.Net/SQL

    I&#039;m developing an application in ASP.Net (VB) and SQL that tracks training module usage.<BR><BR>When the user opens the page a record is saved in SQL (recordID=auto, pagename="blah.aspx", starttime=now, status="Started"). The recordID is retrieved (@@identity).<BR><BR>When the user leaves the page, the window location is changed to the same page with a "?CloseRecordID=&#039;recordID&#039;" in the query string.<BR><BR>An "If/Then" loop at the beginning of the page detects the variable in the querystring and updates the record bearing that recordID (endtime=now, status="Finished").<BR><BR>The problem I&#039;m having is that I want to calculate the Duration and include it in the record. But that would mean changing my sql statement to include a retrieval of the start time, then a calculation of the duration (endtime - starttime), all before updating the record.<BR><BR>Any suggestions? I would leave the duration to be calculated when generating reports, but the duration itself will be used in reporting so I&#039;d probably rather have it in the database.<BR><BR>Help!

  2. #2
    Join Date
    Dec 1969

    Default RE: Calculate Times with ASP.Net/SQL

    ASPFAQ&#039;s. Category: Dates and Times

Posting Permissions

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