Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting reference back after an insert.
Message
From
04/03/1998 10:29:55
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00082474
Message ID:
00082485
Views:
25
>>>I am writing my first c/s app using VFP5 and SQL Server 6.5. My problem is this:
>>>
>>>I want to add, for an example, 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

The problem is, that only SQL Server knows about the Cust_id field - it will not be in the view. The @@identity field is the only way of finding it.

Ian
regards

Ian
Previous
Reply
Map
View

Click here to load this message in the networking platform