Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SPT, updatable cursor and last identity value
Message
From
08/04/2010 02:08:10
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01458392
Message ID:
01459291
Views:
46
This message has been marked as a message which has helped to the initial question of the thread.
>>>>>Fabio,
>>>>>
>>>>>Please read the problem defintion one more time. The SPT cursor is made updatable using technique similar to the one outlined in Vald's blog (so essentially it becomes a remote view).
>>>>>
>>>>>After that we do simple append blank (on insert, doesn't matter) and then tableupdate.
>>>>>
>>>>>My question is how can I get the ID in this particular scenario.
>>>>>
>>>>
>>>>
>>>>IF TABLEUPDATE(.F.)
>>>>  LOCAL newid
>>>>  newid=cast(null as i)
>>>>  SQLEXEC(CURSORGETPROP("ConnectHandle"),"SELECT ?@m.newid = SCOPE_IDENTITY()")
>>>>ENDIF
>>>>
>>>>
>>>We're using a similar approach, but I don't think it's reliable.
>>
>>Why?
>
>What if something happens in between?

What can happen?

The SQL session is exclusive,
and therefore your application must have the control of what can happen.
Previous
Reply
Map
View

Click here to load this message in the networking platform