session question

Results 1 to 2 of 2

Thread: session question

  1. #1
    Join Date
    Dec 1969

    Default session question

    Hi <BR>I am working on room reservation system. I want to hold a booking for five minutes (by inserting some value into sql table). Can I do that with session variable. Can I insert some value during the session and delete at the end of session.<BR>thanks for your time<BR>Julie

  2. #2
    Join Date
    Dec 1969

    Default Why do you need Session variable?

    End of session is notoriously unreliable, and I can&#039;t think of any good reason to use it, anyway.<BR><BR>Just have a field in the DB table which is a Date/Time field.<BR><BR>Let&#039;s say you name it "HoldUntil". And when you create a reservation that is to be held, you simply put the date/time that it is to be held until in that field.<BR><BR>Then every so often (perhaps when the next person comes along to try to make a reservation?) you simply do (for Access)<BR> DELETE FROM reservations WHERE HoldUntil &#060; Now()<BR>or (for SQL Server)<BR> DELETE FROM reservations WHERE HoldUntil &#060; GetDate()<BR><BR>That wipes out any out-of-date holds and presto.<BR><BR>As for setting the value of that field in the first place:<BR> INSERT INTO reservations (field1, HoldUntil, field3)<BR> VALUES( xxx, DateAdd(&#039;m&#039;,5,Now()), yyy )<BR><BR>[Again, you replace Now() with GetDate() if using SQL Server.]<BR><BR>Note that in both cases you do *NOT* use VBScript code to specify the Date/Time. You use functions that are *BUILT IN* to the SQL language you are using.<BR><BR>

Posting Permissions

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