Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieve autoincrement value from SQL server remote view
Message
 
 
To
08/02/2002 12:22:15
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00550467
Message ID:
00617585
Views:
28
>I am doing the same thing but when I first come into my form and click on add I don't get the value of @@identity until I save. Then when I click add again I get the value of @@identity. Why is this happening?
>

Tyler,
Nothing is saved on the back end until you issue a TableUpdate() on the remote view. When the back end is updated, the identity column is generated and the @@Indentity returns a value. When you add a second record, you are getting the identity last generated which was for the previous save.

The technique I described in that post was to post-populate the PK information for the local data in case you needed it for subsequent inserts (e.g. child, grandchild records).

If you want to pre-populate your stuff, you will have to use a different technique. One possibility is to create your own PK table and have a stored procedure access and increment new PKs. The PK table would have one row per table in your system.

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform