CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Time Deviation

  1. #1
    Join Date
    Jan 2005
    Posts
    122

    Question Time Deviation

    Hi all,

    Ok, here is my situation:

    I want to know if a employee worked more or less hours than th expected so I am doing this operation with TimeSpan Vars

    time_deviation = time_work - time_expected;

    now the problem is I need to put that value in a MS-Sql Server Db with and ODBC Connection, but I can't, I tried put like ODBCType.Time and the timespan and it says that funcionallity is not installed, then I tried to save it as dateTime, but datetime does not give you a negative value....

    What do you ppl suggest me to do?

  2. #2
    Join Date
    Mar 2004
    Location
    Prague, Czech Republic, EU
    Posts
    1,701

    Re: Time Deviation

    I would work with simple int instead TimeSpan. Just count difference in minutes. Differences is seconds does not make sence, difference in tens of hours have not to be expected. At least for database, I would store only difference as integer. I think this is the fastest and the most simple solution which would work.
    • Make it run.
    • Make it right.
    • Make it fast.

    Don't hesitate to rate my post.

  3. #3
    Join Date
    Mar 2005
    Location
    Chicago, IL
    Posts
    69

    Re: Time Deviation

    IMHO:
    Have two fields in you table,
    1. a boolean indicating a positive or negative time span.
    2. the actual timespan (datetime type) value. Only that u have to make it a positive value before u get it to the database.
    There has been an alarming increase in the number of things I know nothing about .

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

Featured