Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Shared tables
Message
From
19/10/2004 16:25:20
 
 
To
19/10/2004 15:54:14
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00952755
Message ID:
00952793
Views:
7
In normal programs I always add AGAIN, unless I need to do something 'drastic', meaning when I must use a table EXCLUSIVE. I also always add the ALIAS clause. An example, in a unction to look up a client's address, I may have this line: USE clients ORDER address AGAIN IN 0 ALIAS ClientAddressLookup. Here is a code snippet:
Function FindClientAddress
LPARAMETER cCustId
LOCAL lcAlias,lcReturn
lcAlias=SELECT() && remember the alias
USE clients ORDER custid AGAIN IN 0 ALIAS ClientAddressLookup.
SELECT ClientAddressLookup.
IF SEEK(cCustId)
   lcReturn=ClientAddressLookup.address
ELSE
  lcReturn=''
ENDIF
USE
SELECT (lcAlias) && reset the alias
RETURN lcReturn
This example is not optimized or anything, it is just to show you the way I always does it.

In a form, I always use the DE, or Data Environment, where you pick the tables, and graphically set the relations. I STRONGLY recomemnd that you use the DE. To get to the DE, you right-click on the form, and select Data Environment. You can even subclass the DE if you have many applications with similar setup.

If you need to ZAP tables regularly, I suggest you use cursors in stead.

>hi,
>
>thank you,
>
>i useto put this code under program as tables1.prg
>
>and i put it at the main form at load (do tables1)
>
>inside the main form i run another forms to add ,delete ....
>
>you mean if i want to use any table i must write again, ex.. use mstr in 0
>
>what about alias not found, or the file is open before...
>
>thanks
>
>m.qasem
Previous
Reply
Map
View

Click here to load this message in the networking platform