Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determining Available Indexes for a VFP table, using SPT
Message
From
03/09/2002 07:25:58
 
 
To
02/09/2002 12:54:32
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00693965
Message ID:
00696148
Views:
15
If I understand correctly, you want to be able to query index info via an ODBC datasource for free tables.

Something like the following:?
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

>Hi Mace,
>
>I'll be using that piece of code to retrieve indexes of tables that can be acessed via an ODBC data source. Some times they'll be in a database (DBC) other times they'll be free tables.
>
>In the same way, as you suggested:
>
>?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
>
>
>Thanks for your reply!
>
>Fernando
>
>
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform