Results 1 to 4 of 4

Thread: database-storing time and date

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2003
    Posts
    509

    database-storing time and date

    i have a database created with the following fields:
    Username
    Time and date

    I have a form, when the correct password is entered, i would like for the username (which was selected on the form) to be stored along with the current system time and date.
    The database as it stands is empty and any information should be updated to the database.

    How is it possible to do this?

    thanx in advance.

  2. #2
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    It is definitely possible. What's your database? I work pretty much exclusively with MSSQL 2000, so if you use that, I can help you out - I have code somewhere that does exactly that.

    Mike

  3. #3
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539
    firstly i would give the database a seperate table for this something like, UTB_UserLogins (UTB= User Table ) if using sql its nicer to group the tables together.

    contained within the table i would have.

    RecordId int increment of 1
    FK_UserId int > This would be a relation to the user table (fk = foreign key)
    LoginTime smallDateTime
    LogoutTime smallDateTime

    If your user closes the main form you can fire an event to store when they log out as well

    all you need to do its save the time to get the date and time just use date.today.now()
    If your in england and using SQL db in usa format then your need to change the date format by using something like format(date.today.now,"dd/MM/yyyy") I Think i wrote a class to handle dates so i dont need to worry tomuch anymore

    Well good luck
    Last edited by carlblanchard; Mar 13th, 2004 at 03:37 PM.
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

  4. #4
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    This is a question that would probably be better asked in the database forum.

    but, look into using ado or ado.net to connect to your database and then you'll have to know a bit of sql to stick data into the appropriate tables on the database. Pretty easy actually..once you do it a few 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
  •  



Click Here to Expand Forum to Full Width