Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting reference back after an insert.
Message
De
04/03/1998 10:37:00
Steve Camsell
Windmill Associates
Bath, Royaume Uni
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00082474
Message ID:
00082487
Vues:
27
>>>I want to add, a new record into my customer table. My fox app contains a remote view containing all fields in the customer table, parameterised so that it fetches back only one record, any record. I then do an INSERT into the view, to insert the basic information, allowing my user to fill in the rest.
>>>
>>>I do not fill in the cust_id field, as this is automatically populated by SQL Server using IDENTITY. Therefore in my view it is zero (although the record that has just been added on the server has a cust_id). How do I find out the cust_id of the customer that I have just added?
>>
>>You need to query the server for the global variable
>>
>>@@identity
>>
>>Unfortunately this will mean two SQLs for every insert. I always specify what the id should be from the front end myself.
>>
>>Ian
>
>Hi!
>What about = REQUERY() directly after INSERT and m.Cust_Id = ViewName.Cust_id
>Marat

Hello Marat,

This would be a nice simple solution, except that my view is parameterised to bring back only one record. If I do a REQUERY() after my insert, my new record will disappear as it does not match the original criteria!

I think therefore that I'll probably have to follow Ian's advice and find out the value of @@IDENTITY. Thanks very much for responding anyway.
Steve Camsell
Development Consultant
Steve.Camsell@Windmill-DBM.Co.Uk
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform