Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Identity Key Question
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00142423
Message ID:
00142484
Views:
19
You can use SQL Server's @@IDENTITY variable to find the value of the last record inserted. You must use the same connection you used to insert the record. Try this after you add the record:
llsucess =SQLEXEC(CURSORGETPROP('ConnectHandle','myalias'), ;
  		'SELECT @@IDENTITY AS KeyValue')
This assumes the alias of the view you just added the record to is 'myalias.'

>I ran into this problem today and was wondering if anyone
>can give some ideas on how to handle this...
>
>In the scenario:
>
>Customer_Num I - Identity Key
>Customer_Name C(15)
>
>If I insert Into the SQL Server database using a remote
>view, I do not know the Customer_Num. In Order to
>get the current result set I would need to =Requery() the
>Remote View. When I requery() the remote view, the
>record pointer moves. Since I do not know the
>Customer_Num key, how would I know where to return the
>record pointed to?
>
>This becomes more of a problem if the View is ordered, and
>the returned REQUERY Set had the new record in the middle or so...
>
>Locateing for the Customer_name is not really any option
>Since we could possible have the same name for different customer
>#'s...
>
>Anyone have any thoughts on this?
>
>Bob
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform