Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help - What am I doing wrong with this primary key
Message
From
06/12/2000 04:39:02
 
 
To
05/12/2000 12:50:22
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00449457
Message ID:
00449839
Views:
8
>>>>Thanks Trey



>It won't get called twice. Since the p_ticket field in the inserted record in the view already has a value, the default of the p_ticket in the table won't fire when the view is updated.
>If you don't believe me, try it and see :)



It does seem to be firing twice Trey.

I think this is because the insert command first inserts a blank record before doing the rest of the insert.

Maybe I could alter my nextkey routine so that it does not set the primary key value unless the current value is 0.

This would stop it overwriting the first primary key generated when the nextkey runs for the second time.

here is my code. I have put a WAIT WINDOW in NEXTKEY routine as well so that I can see it firing.


sele v_ticket
DBSetProp("v_ticket.p_ticket", "Field", "Default", "NextKey('P_TICKET')")
insert into v_ticket (ticket) values (myvalue)
go recno()
wait window ' v_ticket '+trans(v_ticket.p_ticket)+' ticket '+trans(ticket.p_ticket)
return v_ticket.p_ticket


I am getting a bit desperate on this one so any and all help most greatfully receievd.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform