General information
Category:
Visual FoxPro and .NET
>Aleksey,
>
>>No, Michel, I am saying that, if you want to get the value back, you can execute GETAUTOINCVALUE(0) as a procedure after Insert. If you simply want to use the value in the subsequent Insert then you can use GETAUTOINCVALUE(0) in VALUES list of the INSERT command.
>
>Is that code multiuser/multithread safe? I really don't see how getautoincvalue() can be used outside the context of a VFP stored proc. Also this function would seem to fail should the inserted table have an INSERT trigger which causes another autoinc field in another table to be consumed.
>
>Similar to have to using scope_identity() rather than @@identity in SQL server.
Hi David,
I believe VFPOLEDB is multiuser and multithread safe.
If you pass 0 to GETAUTOINCVALUE, it is similar to scope_identity(). Help is pretty clear on this: "0 Specifies that the last autoincremented field value returned is derived from the current scope (function, method, procedure)." Connection is a scope. Therefore, additional synchronization should be used if you execute INSERTs and GETAUTOINCVALUE(0) on different threads at the same time through the same connection (no difference with scope_identity() here).
Aleksey.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only