LOCAL lnCount, lnHandle, lcCursor, lnSelect lnSelect = SELECT( 0) lcCursor = SYS( 2015) *-- Connect to the tables using SPT the ODBC vfp directory dsn is called tables lnHandle = SQLCONNECT( "Tables") FOR lnCount = 1 TO 254 lcCommand = "Select TAG(" + LTRIM( STR(lnCount)) + ") AS MyTag, KEY(" + LTRIM( STR(lnCount)) + ") AS MyKey FROM Table1 WHERE RECNO() = 1" SQLEXEC( lnHandle, lcCommand, lcCursor) IF EMPTY( EVALUATE( lcCursor + ".MyTag")) EXIT ELSE *-- Store the index stuff somewhere WAIT WINDOW EVALUATE( lcCursor + ".MyTag") + SPACE( 1) + EVALUATE( lcCursor + ".MyKey") ENDIF ENDFOR &&* lnCount = 1 TO 254 USE IN SELECT( lcCursor) SELECT ( lnSelect)Mace
>?SQLEXEC( gVFPHandle, "Select KEY(2, 'table1') from table1 where recno()=1") >>Do you think it would be possible to use a sequence that would do much the same as (using the appropriate SQLexec statements, as above):
>Use Table1 > >For nCount = 1 TO 254 > > If Empty (Tag (nCount)) > Exit > endif > > wait window Tag (nCount) + chr (13) + Key (nCount) > >EndFor > >Use >>