Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SET relation problem in database container of VFP 3
Message
From
10/08/1999 00:25:07
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
SET relation problem in database container of VFP 3
Miscellaneous
Thread ID:
00251865
Message ID:
00251865
Views:
70
Hi,

One of my application written in VFP 3, using the DBC database container, when one of the CDX file is deleted, always give problem of 'primary key is invalid, please validate database'.

I come up with a solution to solve that, however, two of the DBF file
had relation which I can use code to break the link by 'remove table user_level'. It always give me error of 'table xxxxx is referenced in a relations' The code is show below

*********
IF !FILE('user_lev.cdx')

FREE TABLE user_lev <-- ok
SET DATABASE TO pos_inv <-- ok
REMOVE TABLE user_level <- error, this part give the error
ADD TABLE user_lev NAME user_level
ALTER TABLE user_lev RENAME COLUMN descriptio TO description
ALTER TABLE user_lev RENAME COLUMN startup_ac TO tartup_action
USE IN user_level
USE user_lev IN 0 EXCLUSIVE
SELECT user_lev
INDEX ON group_id TAG GROUP_ID OF user_lev
ALTER TABLE user_lev ADD PRIMARY KEY GROUP_ID TAG GROUP_ID
INDEX ON UPPER(description) TAG DESCRIPTION
USE IN user_lev
lchkUser = .T.
ENDIF
****************



Please advise or help me on how to solve the breaking of the link
between the two table using code as I am written a program on using it. The command - 'set relation off into' does not work.

Both table are related by this command

ALTER TABLE EMPLOYEE ADD FOREIGN KEY TAG GROUP_ID REFERENCES USER_LEVEL TAG GROUP_ID
Best Regards
Virusim
Reply
Map
View

Click here to load this message in the networking platform