> > Have you any examples of poor or even terrible code that has really left you scrambling for a resolution to a weird error?
>
>
SELECT CPY.company_name, CTC.firstname, CTC.lastname ;
> FROM company CPY ;
> LEFT OUTER JOIN contacts CTC ON CTC.companyfk = CPY.companypk ;
> WHERE CPY.company_name LIKE "A%" ;
> INTO CURSOR cur_list
>
> SELECT cur_list
> SCAN
> lcName = ALLTRIM( lastname ) + IIF( NOT EMPTY( firstname ), ", " + ALLTRIM( firstname ), "" )
> *** More code here
> ENDSCAN
>
> The catch above? No test for NULLS! Note the OUTER JOIN in the query. Concatenating the names like this results in NULL if either the First, or Last name is NULL. It is an anomaly (if not actually a bug) that ALLTRIM( NULL ) returns NULL and not an error even though attempting to ALLTRIM() any other invalid data does throw an error.
>
guess thats SPT !? coz name should be a string field or Cast into one !?
> Regards
> Andy Kramek
> Microsoft MVP (Visual FoxPro)
>
Tightline Computers Inc, Akron Ohio, USA