Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ttod
Message
From
15/03/2001 15:06:42
 
 
To
15/03/2001 15:01:26
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Re: Ttod
Miscellaneous
Thread ID:
00485533
Message ID:
00485557
Views:
9
>>>>>I have a data file that has a datetime field and I need to allow a user to get records between 2 dates. In the view builder I select ttod(dtfield) >= userstartdt (where userstartdt) is a date variable.
>>>>>
>>>>>The query blows up saying operator operand type mismatch. If I substitute date() in for userstartdt the query runs fine.
>>>>>
>>>>>Any Ideas?
>>>>
>>>>UserStartDT, as used in your expression, *must* be a Date type - which is not what your variable name implies. Look at the actual value and type of UserStartDT in the debugger or at the command prompt.
>>>
>>>I agree thats what it would look like but when I look it up its absolutely a date. I can even add 4 to it and get a date 4 days ahead.
>>
>>Do you have any NULLs in your data?
>
>Yes there are some in the raw data of the table but the condition before this screens them out so there are none in the cursor. I probably could kill all the nulls in the raw data. Do you think that would help? If its that why would date() still work?
>
>CG

Look at your expression:
ttod(dtfield) >= userstartdt
The left side, ttod(dtField) should always return a Date expression. It will fail if the value of dtField is anything other than a DateTime. Similarly, userstartdt must always evaluate to a Date, otherwise the >= operator will fail. If DATE() always works, then I would suggest that userstartdt is NOT always a date.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform