DTOC() 
Author Message
 DTOC()

Hi all!

lcFieldName = 'Company'
lcSearchStr = '2002-06-25'     && or 2002-06-25
lcAnalysedCondition = lcFieldName + " = {" + DTOC(lcSearchStr) + "}"

The code above generates an error (wrong type). How can I have lcSearchStr
to contain an acceptable value?

Regards
Christina



Sat, 11 Dec 2004 06:28:53 GMT  
 DTOC()
DTOC() converts a date to a character value, but you're starting with a
character value.

'2002-06-25' is character.
{2002-06-25} is a date

If you want to concatenate two strings, there's no need for DTOC() at all.
Take it out and this should work fine.

Dan


Quote:
> Hi all!

> lcFieldName = 'Company'
> lcSearchStr = '2002-06-25'     && or 2002-06-25
> lcAnalysedCondition = lcFieldName + " = {" + DTOC(lcSearchStr) + "}"

> The code above generates an error (wrong type). How can I have lcSearchStr
> to contain an acceptable value?

> Regards
> Christina



Sat, 11 Dec 2004 06:53:41 GMT  
 DTOC()

Quote:
> lcFieldName = 'Company'
> lcSearchStr = '2002-06-25'     && or 2002-06-25
> lcAnalysedCondition = lcFieldName + " = {" + DTOC(lcSearchStr) + "}"

If you want to sort on a date, you must convert the date to a string with
the year first and the date last:
lcDate = DTOS(<Date>)

HTH
Turan



Sat, 11 Dec 2004 15:13:13 GMT  
 DTOC()
Hi,

Just to add to the other posts, I would add ",1" to the
DTOC command, since your lcAnalysedCondition
could be an index, isn't it ?

lcSearchStr = DTOC({^2002/06/25},1)

Arnaud

Quote:
>-----Original Message-----
>Hi all!

>lcFieldName = 'Company'
>lcSearchStr = '2002-06-25'     && or 2002-06-25
>lcAnalysedCondition = lcFieldName + " = {" + DTOC
(lcSearchStr) + "}"

>The code above generates an error (wrong type). How can I
have lcSearchStr
>to contain an acceptable value?

>Regards
>Christina

>.



Sat, 11 Dec 2004 18:43:03 GMT  
 DTOC()
Hi Dan and Turan and thank you!

The solutution was
lcSearchStr = '2002-06-25'
lcAnalysedCondition = lcFieldName + " = " + "{^" + cSearchStr + "}"

Regards
Christina



Quote:
> > lcFieldName = 'Company'
> > lcSearchStr = '2002-06-25'     && or 2002-06-25
> > lcAnalysedCondition = lcFieldName + " = {" + DTOC(lcSearchStr) + "}"

> If you want to sort on a date, you must convert the date to a string with
> the year first and the date last:
> lcDate = DTOS(<Date>)

> HTH
> Turan



Sun, 12 Dec 2004 04:46:00 GMT  
 DTOC()
Arnaud,

lcSearchStr = DTOC({^2002/06/25},1)
lcSearchStr = DTOS({^2002/06/25})

These values have the same return strings.  Both were posted and I just
wanted to point that out...


Quote:
> Hi,

> Just to add to the other posts, I would add ",1" to the
> DTOC command, since your lcAnalysedCondition
> could be an index, isn't it ?

> lcSearchStr = DTOC({^2002/06/25},1)

> Arnaud

> >-----Original Message-----
> >Hi all!

> >lcFieldName = 'Company'
> >lcSearchStr = '2002-06-25'     && or 2002-06-25
> >lcAnalysedCondition = lcFieldName + " = {" + DTOC
> (lcSearchStr) + "}"

> >The code above generates an error (wrong type). How can I
> have lcSearchStr
> >to contain an acceptable value?

> >Regards
> >Christina

> >.



Tue, 18 Jan 2005 21:35:12 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Query against Dtoc(Date()) function question

2. DTOC & CTOD

3. VFP 5.0: problem with DTOC

4. "dtoc" not found

5. DTOC function in ODBC

6. DTOC & CTOD

 

 
Powered by phpBB® Forum Software