Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help - What am I doing wrong with this primary key
Message
From
05/12/2000 12:12:39
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Help - What am I doing wrong with this primary key
Miscellaneous
Thread ID:
00449457
Message ID:
00449457
Views:
54
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
Next
Reply
Map
View

Click here to load this message in the networking platform