Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ttod on dynamic sql
Message
From
19/06/2009 06:03:44
Lutz Scheffler (Online)
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
19/06/2009 05:25:34
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01407095
Message ID:
01407100
Views:
30
Lo,
your code will work only if
mycursor.createtime is of format Time (no string that looks like) - use ?TYPE(mycursor.createtime) it should return T
and
thisform.txtdate() returns a perfectly date literal as string

Date Literal
{^2009.06.19}

TRANSFORM(dDate) will return something like 19/06/2009 (whatever your date time format is) if you put a date value into it, not the literal

so your string would look like
cquerystring = "ttod(mycursor.createtime)=19/06/2009"
try
?ttod(mycursor.createtime)=19/06/2009
*or even
?date()=19/06/2009
this will not work

so you would need something like
cquerystring=''
cquerystring='select * from mycursor where .t.'&&get all lines

ldDated = thisform.txtdate()   &&return is a date
cdated=TRANSFORM(YEAR(ldDated)*10000+MONTH(ldDated)*100+DAY(ldDated),[{^9999-99-99}]) &&create proper literal

cdone='ttod(mycursor.createtime)'
cdt='>'
cquerystring=cquerystring+' and '+cdone+cdt+cdated
messagebox(cquerystring)&&show the query syntax for debug
&cquerystring
Agnes
>Hi
>I create dynamic Sql select.
>One option of query is specific date> mycursor.createtime(datetime field).
>The date work fine in by transform but how can I do it on the cursor field?
>Eample:
>
cquerystring=''
>cquerystring='select * from mycursor where .t.'&&get all lines
>cdated=transform(thisform.txtdate())&&it's OK
>cdone='ttod(mycursor.createtime)'&&&&&&&&&&Here the problem 
>cdt='>'
>cquerystring=cquerystring+' and '+cdone+cdt+cdated
>messagebox(cquerystring)&&show the query syntax for debug
>&cquerystring
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Reply
Map
View

Click here to load this message in the networking platform