Re: VB & SAL Date/Time Problem?

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

From: Uri Dimant (urid_at_iscar.co.il)
Date: 12/20/04


Date: Mon, 20 Dec 2004 15:40:59 +0200

Richard
Write a stored procedure that accepts a datetime parameter. On the client
site you can format it as YYYYMMDD.

"Richard Gutery" <rgutery@mentorits.com> wrote in message
news:OE2l1gp5EHA.1392@tk2msftngp13.phx.gbl...
> 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 logic in my program prevents them from logging in again for some
period
> of time.
> 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 problem 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 (I actually pull this from another table, it's here for
> clarity)
> 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

  • Re: VB & SAL Date/Time Problem?
    ... you don't need to be concerned with datetime ... SQL Server MVP ... > I've written an ASP app that requires users to login - normal stuff. ... > So I believe that what I need to do is to convert the date time format ...
    (microsoft.public.sqlserver.programming)
  • DB on Pocket PC Again
    ... i've got to build a database application for a pocket pc device. ... i've seen "sql ce". ... app" db in a sqlce-compatbile format? ... app read directly ms-access (format used by our pc app) file format? ...
    (microsoft.public.pocketpc.developer)
  • Re: SQL Compare Date Fields using Where
    ... You cannot debug syntax issues with sql statements without knowing what the ... display the sql statement constructed by your code. ... This enables you to, if the syntax error still escapes you, copy the sql ... US format: m/d/yyyy ...
    (microsoft.public.scripting.vbscript)
  • Populating 10G XE table with time AND date through VB.Net
    ... This SQL statement delivered through VB.Net works fine: ... This is fair enough - presumably because the NLS_TIME_FORMAT is wrong format. ... If I run exactly same statement from within Oracle GUI SQL window I get: ...
    (comp.databases.oracle.server)
  • Re: SQL and Scientific Notation
    ... define format of LargeImport.txt file there. ... Vassiliev V. V. ... When I executed the sql ... Does anyone know why the sql statement is switching the data being read ...
    (borland.public.delphi.database.ado)