Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
One Works, One Doesn't
Message
From
26/06/2006 16:41:29
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Miscellaneous
Thread ID:
01131819
Message ID:
01131829
Views:
14
Sheesh, thanks Borislav! I had tried (the 2nd example) over and over but just now realized (after looking at your code example) that I had a typo the entire time. Ridiculous! It's working now thanks to you!

Tracy

>You must pass it as parameter or assign directly the value of sqlresults.untypeid
>I prefer this way (more visible and with syntax coloring)
>
>
>TEXT TO lcSelect NOSHOW PRETEXT 15 TEXTMERGE
>     SELECT b.*
>            FROM untype a
>            INNER JOIN incilog b on LTRIM(RTRIM(a.unitcode)) = LTRIM(RTRIM(b.unitcode))
>                                AND LTRIM(RTRIM(a.unittype)) = LTRIM(RTRIM(b.usertyped))" ;
>            WHERE a.inactive = 'TRUE' AND
>                  a.untypeid = <<sqlresults.untypeid>> -- If untypeid type is differenet than numeric you must convert it
>ENDTEXT
>
>* or
>TEXT TO lcSelect NOSHOW PRETEXT 15 TEXTMERGE
>     SELECT b.*
>            FROM untype a
>            INNER JOIN incilog b on LTRIM(RTRIM(a.unitcode)) = LTRIM(RTRIM(b.unitcode))
>                                AND LTRIM(RTRIM(a.unittype)) = LTRIM(RTRIM(b.usertyped))" ;
>            WHERE a.inactive = 'TRUE' AND
>                  a.untypeid = ?sqlresults.untypeid -- No convertion needeed
>ENDTEXT
>
>
>>This works to pull all that match between two tables in SQL Express 2005:
>>
>>lcSelect = "SELECT " ;
>>+" b.* " ;
>>+" FROM untype a INNER JOIN incilog b on LTRIM(RTRIM(a.unitcode)) = LTRIM(RTRIM(b.unitcode))" ;
>>+" AND LTRIM(RTRIM(a.unittype)) = LTRIM(RTRIM(b.usertyped))" ;
>>+" WHERE a.inactive = 'TRUE'"
>>
>>?SQLEXEC(lnconnhandle, lcselect, 'myresults')
>>
>>However, now I want to do the same but match only pull where a.untypeid=sqlresults.untypeid
>>
>>sqlresults.untypeid is a field in the table currently open table. Untype.untypeid should match it.
>>
>>However, the code below returns -1:
>>
>>lcSelect = "SELECT " ;
>>+" b.* " ;
>>+" FROM untype a INNER JOIN incilog b on LTRIM(RTRIM(a.unitcode)) = LTRIM(RTRIM(b.unitcode))" ;
>>+" AND LTRIM(RTRIM(a.unittype)) = LTRIM(RTRIM(b.usertyped))" ;
>>+" WHERE a.inactive = 'TRUE' AND a.untypeid = sqlresults.untypeid"
>>
>>?SQLEXEC(lnconnhandle, lcselect, 'myresults')
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform