Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

How to compare TimeValues ???

I try to compare 2 differtent TimeValues via "<" ">" like

Select * from Time where time.time1 < 'enteredTime' .
I did it from my code in Visual Basic , but get always an ODBC - called faild ! Hope someone can help me ... ThanX
  • 2
1 Solution
Victor SpiridonovCommented:
'ODBC call failed ' is only the first part of ther error ,what does full text says?
Also, run SQL Trace when executing this query,and see what is actualy being sent to the server (and post here).
Do this..

ls_SQL = "SELECT * FROM TimeTable WHERE " _
        & " TimeTable.Time1 < " _
        & "'" & format(enteredTime,"HH:MM:SS") & "'"

'or whatever format your Time1 field is..
Victor SpiridonovCommented:
The proposed answer will not work. In SQL Server date and time are stored in the same field.

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now