Primeri Programm Na Visual Foxpro

  • 18 Comments!

Hi, In a database, I have 2 tables: tb1 and tb2. Tb1 has a primary index (mytag1), and a 'for' condition (for not deleted()). Tb2 also has a primary index (mytag2). If I want to establish a relationship between tb2 and tb1 in a program, using: alter table tb1 add fore key mytag2 tag mytag1 refe tb2 I receive the warning: 'mytag1 already exists, and is a PRIMARY or CANDIDATE index tag. Overwite it?' The options being 'Yes' or 'No'.

Tutorial: FoxPro E - Database Indexing & Searching. After we learn to make a create a primary index from the Name field of the Client.DBF, the.

As I want to preserve the for condition, of course I have to press 'No' button. But this is a risk in a program, where the user might choose 'Yes', and spoil everything. Can anybody advice me? Thank you, Florin Cherbis Sat, 28 May 2005 23:24:27 GMT. > In a database, I have 2 tables: tb1 and tb2. Tb1 has a > primary index (mytag1), and a 'for' condition (for not > deleted()). Tb2 also has a primary index (mytag2).

> If I want to establish a relationship between tb2 and tb1 > in a program, using: > alter table tb1 add fore key mytag2 tag mytag1 refe tb2 If you're adding a new column to your table and you want an index on it why are you giving it the TAG name you are using for the existing index? Seems to me you should use the name of the new field for the TAG - something like: ALTER TABLE Tb1; ADD FOREIGN KEY MyTag2 TAG MyTag2; REFERENCES Tb2 -- Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP Sun, 29 May 2005 07:37:52 GMT.

Hi, I am not adding a new field (column as the command says). I just wanted to create the relationship between the 2 tables, that already have each a tag in their.cdx compound structural index (mytag1 for tb1 and mytag2 for tb2). I cannot change the name of tags (they already are used in a lot of places allover the app, and I have to keep the 'for not deleted()' filter for mytag1. If I'd use the sentence you proposed, I guess another (new) tag will be added to the tb1's.CDX index, designing of course the same field but without being primary and without 'for.' Filter, am I right? And I do not want this (in fact, is not the problem if I want it or not, but I have to use the existing.CDX's tag names and conditions.

I hope I was more specific this time and I made myself understood. I very lot appreciate your help, thank you. Florin Cherbis. >Hi, >I am not adding a new field (column as the command says). >I just wanted to create the relationship between the 2 >tables, that already have each a tag in their.cdx >compound structural index (mytag1 for tb1 and mytag2 for >tb2). I cannot change the name of tags (they already are >used in a lot of places allover the app, and I have to >keep the 'for not deleted()' filter for mytag1. If I'd >use the sentence you proposed, I guess another (new) tag >will be added to the tb1's.CDX index, designing of >course the same field but without being primary and >without 'for.' Otziv rukovoditelya o rabotnike primer.

Filter, am I right? And I do not want >this (in fact, is not the problem if I want it or not, >but I have to use the existing.CDX's tag names and >conditions. >I hope I was more specific this time and I made myself >understood. >I very lot appreciate your help, thank you. >Florin Cherbis For temporary relations use SET RELATION TO For persisten relations, the complete sintax of ALTER TABLE is: ALTER TABLE TableName1 ADD ALTER [COLUMN] FieldName1 FieldType [(nFieldWidth [, nPrecision])] [NULL NOT NULL] [CHECK lExpression1 [ERROR cMessageText1]] [DEFAULT eExpression1] [PRIMARY KEY UNIQUE] [REFERENCES TableName2 [TAG TagName1]] [NOCPTRANS] [NOVALIDATE] See the [REFERENCES TableName2 [TAG TagName1]] modifier. Alex Feldstein ________________________________ Microsoft Visual FoxPro MVP Please respond in the public groups so that everybody can benefit from the exchange. Favor de responder en los foros pblicos asi todos se benefician.