SQL & VB Dates/Times!!!

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Richard Gutery (rgutery_at_mentorits.com)
Date: 12/20/04


Date: Mon, 20 Dec 2004 06:26:54 -0700

I've written an asp app that requires users to login - normal stuff.

As is typical with users, sometimes they just close the browser which
teminates the app. What I've done is created a new table in SQL that inserts
the date & time when a user logs in. All is well as other stuff.

If the user then comes along and tries to log in again, I place this
information into another table (for troubleshooting and reporting). However
the login in my program prevents them from logging in again (I do a query
against Active_Users table) and if the user id is in the table, they cannot
login again. We do this so that users don't run multiple copies of the
browser (we know that users minimize stuff). Our app cannot allow users to
log in more that once during an active session.

What I'd like to be able to do is to delete an OLD record (say from
yesterday in an ADMIN capacity) from the table based on the current
date/time.

My probleme is that all records get deleted from the table based on the
following SQL statement:

StrSql = "DELETE FROM active_users WHERE Last_Seen <=' " &
DateValue(StrOnlineTimedOut) & "'"

Date/Time format in SQL: 2004-12-20 05:58:00.
Format of StrOnlineTImedOut: 12/20/2004 6:18:20 AM

Script looks like this (essentially StrOnlineTimedOut is 5 minutes from
NOW):
onlinedate = now()
strTimeout = 1
StrOnlineTimedout = dateadd("n",-strtimeout*5,onlinedate)

So I believe that what I need to do is to convert the date time format from
VB to an SQL format?

Does anyone know of a VB Date/Time statement that will do this?

Thanks in advance.

RG



Relevant Pages

  • VB & SAL Date/Time Problem?
    ... I've written an ASP app that requires users to login - normal stuff. ... We do this so that users don't run multiple copies of the browser ... Script looks like this (essentially StrOnlineTimedOut is 5 minutes from ...
    (microsoft.public.sqlserver.programming)
  • Re: 2003 Server ASP.NET Problem (IE Only!)
    ... Is scripting disabled in the browser? ... It doesn't seem to be a problem with IIS, since IIS does not care about ... > first screen and clicks "Login", but the app doesn't do anything. ...
    (microsoft.public.inetserver.iis)
  • Re: Coonect to mail account using Tcl/Tk
    ... Opens an Browser the specified url... ... $app Navigate http://gmail.com ... set user [lindex $argv 0] ... User types his login info on the command line in which case he might ...
    (comp.lang.tcl)
  • Re: How to logoff?
    ... when they close the browser ... ... > I have windows integrated authentication for a asp.net app. ... > browser that login will be authenticated as long as it's open, ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Access 2010 with Sharepoint 2010
    ... the browser as in Access itself? ... I've said elsewhere that I'm wary of embedded macros because of the ... An existing app ... that when I deploy to the client system, ...
    (comp.databases.ms-access)