Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help - What am I doing wrong with this primary key
Message
De
05/12/2000 12:12:39
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Help - What am I doing wrong with this primary key
Divers
Thread ID:
00449457
Message ID:
00449457
Vues:
55
I have a table TICKET
It has a primary key called P_Ticket

I have an indexed view onto this Table called V_TICKET ( CURSORSETPROP("Buffering",3) )

To insert a record I am doing the following

*I insert a record into v_ticket

insert into v_ticket (ticket) values (myValue)
=tableupdate(.t.)

* This triggers NextKey routine which now generates a primary key for me

At this point I have a primary key in my TICKET table but I do not have a Primary key in my V_TICKET view table.

Since I need this key to be in my view I populate the view primary key as follows

REPLACE v_ticket.P_ticket WITH giPrimaryKey && giPrimaryKey gets set when nextkey() is run

* if I now do a table update (to be on the safe side)
=tableupdate(.t.)

at this point my update fails with update conflict.

I realise that I can do a REQUERY() instead of the above REPLACE but it is very inefficient to do this at this point.

Please advise me if there is a solution to this problem.

(Using Tableupdate with the lForce set stops the update failing but this is not desirable)

Many Thanks
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform